Skip to content

OrbitControls: Fix zoomToCursor when dollying with the mouse. - #34856

Merged
Mugen87 merged 1 commit into
devfrom
orbitcontrols-dolly-zoom-to-cursor
Oct 7, 2026
Merged

Mugen87 merged 1 commit into
devfrom
orbitcontrols-dolly-zoom-to-cursor

Conversation

@mrdoob

@mrdoob mrdoob commented Oct 7, 2026

Copy link
Copy Markdown
Owner

Description

With zoomToCursor = true, dollying with the mouse (middle button, also in MapControls) didn't zoom towards the cursor, for two reasons:

  • _handleMouseDownDolly() passed event.clientX as 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 _performCursorZoom after every call, but it was only set on pointer down. So only the first move zoomed towards the cursor, or none if update() 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 = false behave as before. It can be tested in misc_controls_map by enabling zoomToCursor and dragging with the middle button.

@mrdoob mrdoob added this to the r187 milestone Oct 7, 2026
@Mugen87
Mugen87 merged commit 5088b1c into dev Oct 7, 2026
9 checks passed
@mrdoob
mrdoob deleted the orbitcontrols-dolly-zoom-to-cursor branch October 7, 2026 08:58
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.

2 participants