Motivation
The terrain viewer's drag-pan currently translates one pixel of mouse movement into a fixed amount of world-space movement. Because the camera can zoom across a wide range of distances, the same gesture produces wildly different perceived speeds: dragging feels sluggish when zoomed out and twitchy when zoomed in.
Mainstream map UIs (Google Maps, etc.) make the point the cursor grabbed stay under the cursor for the entire drag, so the on-screen distance the cursor travels equals the on-screen distance the map moves. We should do the same.
Approach sketch
- During drag, project the cursor's screen position to the ground plane (XY plane at z=0) via raycast, both at the previous frame and the current frame.
- The world-space delta between those two ground-plane hits is the amount the camera should translate in the opposite direction, so the grabbed point stays glued to the cursor.
- This naturally scales with zoom: when the camera is close, a one-pixel cursor move maps to a small world delta; when zoomed out, the same pixel maps to a much larger delta.
- Replace the current
deltaMouse * 1 accumulation in #moveCameraXY (camera-controller.ts) with this projection-based delta.
Out of scope
- Keyboard pan speed and wheel zoom speed stay as they are; this issue is only about mouse-drag pan.
- Tilt (middle-button drag) is angular and not affected.
References
Motivation
The terrain viewer's drag-pan currently translates one pixel of mouse movement into a fixed amount of world-space movement. Because the camera can zoom across a wide range of distances, the same gesture produces wildly different perceived speeds: dragging feels sluggish when zoomed out and twitchy when zoomed in.
Mainstream map UIs (Google Maps, etc.) make the point the cursor grabbed stay under the cursor for the entire drag, so the on-screen distance the cursor travels equals the on-screen distance the map moves. We should do the same.
Approach sketch
deltaMouse * 1accumulation in#moveCameraXY(camera-controller.ts) with this projection-based delta.Out of scope
References