Repository navigation
OrbitControls: Fix zoomToCursor when dollying with the mouse. - #34856
Merged
Merged
Conversation
Mugen87
approved these changes
Oct 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
With
zoomToCursor = true, dollying with the mouse (middle button, also inMapControls) didn't zoom towards the cursor, for two reasons:_handleMouseDownDolly()passedevent.clientXas both coordinates to_updateZoomParameters(), so the vertical position came from the horizontal one. This regressed in OrbitControls: zoom-to-cursor on touch eventsΒ #27384.update()resets_performCursorZoomafter every call, but it was only set on pointer down. So only the first move zoomed towards the cursor, or none ifupdate()was called in between, e.g. by the app's animation loop. This has been the case since OrbitControls: Add zoom to cursorΒ #26165._handleMouseMoveDolly()now enables the cursor zoom on every move, towards the position where the drag started. The point under the cursor stays under it, and the result is the same as scrolling the wheel by the same amount at that position.Wheel, touch and
zoomToCursor = falsebehave as before. It can be tested inmisc_controls_mapby enablingzoomToCursorand dragging with the middle button.