Expand description
Arcball orbit/pan/zoom (R22) — the ArcballControls feel the user base has
muscle memory for, as a pure state machine over ViewCamera:
- left drag = trackball rotate (Shoemake sphere/hyperbola blend, 1:1),
- right/middle drag = pan (scene follows the cursor),
- wheel = zoom about the target, a gentle exponential step per notch
(
enableAnimationswas false in the app, so there is deliberately NO inertia/damping; the smooth ramp comes from egui’s own per-frame scroll smoothing — see [ZOOM_PER_NOTCH]).
Input arrives as forwarded browser pointer/wheel events through the R3 API (CSS pixels); the same struct drives the winit desktop shell.
Structs§
Enums§
Constants§
- BUTTON_
LEFT - Buttons follow the browser
PointerEvent.buttonvalues. - BUTTON_
MIDDLE - BUTTON_
RIGHT
Functions§
- pan
- Pan by a screen-space delta in CSS px: the scene follows the cursor (dragging right moves the model right, i.e. the camera left).
- zoom
- Zoom by a frustum-scale factor (>1 zooms out).
- zoom_
toward - Zoom by
factorwhile keeping the world point under the cursor fixed — “zoom toward the mouse”.cx,cyare cursor CSS px (top-left origin).