Skip to main content

Module controls

Module controls 

Source
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 (enableAnimations was 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§

ArcballControls

Enums§

Gesture

Constants§

BUTTON_LEFT
Buttons follow the browser PointerEvent.button values.
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 factor while keeping the world point under the cursor fixed — “zoom toward the mouse”. cx,cy are cursor CSS px (top-left origin).