Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve zooming behavior with orbitControl() #6105

Merged
merged 3 commits into from
Apr 18, 2023
Merged

Improve zooming behavior with orbitControl() #6105

merged 3 commits into from
Apr 18, 2023

Conversation

inaridarkfox4231
Copy link
Contributor

@inaridarkfox4231 inaridarkfox4231 commented Apr 14, 2023

Overview

Currently, scaling with webgl's orbitControl() results in jerky behavior.
This is because the judgment method is inappropriate. This is because the change in WheelDeltaY is detected when only the change in WheelY should be detected.
But the problem doesn't stop there. In spite of the fact that behavior that does not depend on the scale is required, the change in the distance from the gaze point is executed by addition and subtraction.
This pull request is to fix these issues.

Resolves #6104

Changes:

First, set sensitivityZ to 1 and prepare a separate scale for zooming.
The decision should be made using the change in WheelY instead of the change in WheelDeltaY.
Furthermore, by changing the distance using a logarithm, the behavior is not affected by the size of the scale.
Finally, let's limit the distance using near and far clips. Because 0.1 doesn't make sense for some scales.

Screenshots of the change:

sample code: improve zooming

PR Checklist

Set the sensitivityZ default to 1 and prepare a separate scale factor for zooming.
Also change the spec so that the scale changes when _mouseWheelDeltaY changes.
Instead of using addition and subtraction to change distances, logarithms and multiplications are used to change distances.
This allows you to achieve the same operability regardless of scale.
In addition, we will use near and far clips for distance validation. Because the number 0.1 doesn't make sense depending on the scale.
Fixed unit test because _orbit() has different result when 3rd argument is not 0.
@inaridarkfox4231
Copy link
Contributor Author

inaridarkfox4231 commented Apr 14, 2023

It shows how the scaling behavior is improved by applying the patch.

2023-04-15.01-47-20_1.mp4

Copy link
Contributor

@davepagurek davepagurek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for making these changes, it definitely feels better!

@davepagurek davepagurek merged commit 9cd2aa0 into processing:main Apr 18, 2023
@inaridarkfox4231
Copy link
Contributor Author

thanks very much for merge! ('ω')
There is still room for improvement in orbitControl(), so I would like to propose some more in the future.

@inaridarkfox4231 inaridarkfox4231 deleted the improve-orbitControl branch April 18, 2023 16:20
@Qianqianye
Copy link
Contributor

Thanks @inaridarkfox4231 and @davepagurek 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve scaling specs when executing webgl's orbitControl()
3 participants