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

OrbitControls: fix zoom-changed detection #27834

Merged
merged 2 commits into from
Feb 27, 2024

Conversation

sciecode
Copy link
Contributor

Fixes #27831

At some point our logic for detecting zoomChanged was modified and it is currently not functioning properly. Currently, the changes are being detected by the condition that validates camera movement and not actual zoom, however this is unreliable as seen in the linked issue.

I made sure to properly detect changes for every variation of zoom logic (ortho/persp for zoomToCursor and regular zoom).

Also took the opportunity to only set this variable if zoom was actually modified, and not every time it is attempted. This way, if the zoom event is triggered but camera is already clamped to min/max distance, an event won't be triggered falsely.

@Mugen87 Mugen87 added this to the r162 milestone Feb 27, 2024
@sciecode
Copy link
Contributor Author

Just validating a few edge cases to make sure everything is working properly, will merge soon.

@sciecode
Copy link
Contributor Author

sciecode commented Feb 27, 2024

Everything appears to be functioning properly.

https://jsfiddle.net/dhqg9f8x/ (ortho)
https://jsfiddle.net/wdpLc4xk/ (persp)

@sciecode sciecode merged commit 89aa843 into mrdoob:dev Feb 27, 2024
11 checks passed
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.

OrbitControls choppy zoom with RenderOnDemand
2 participants