Skip to main content

Module camera

Module camera 

Source
Expand description

The camera the session owns: where the diagram is shown from, how a framing glides into place, and what the host’s own moves — a pan, a wheel notch, a pinch — do to it.

The host reads its pointer and reports a Move; the session applies it, eases a framing a frame at a time on its own clock, and answers the vantage back through the view. Nothing here knows what the viewport is drawn with.

Structs§

Camera 🔒
The session’s camera: where it stands, where it is easing to, the screen it is shown on and the part of that the chrome leaves clear.

Enums§

CameraWork
Whether the user worked the camera themselves this frame — a wheel, a pinch, a drag pan, a zoom step. The undo stack names an entry by the move that made it, and a fit is not a pan.
Glide
Whether a framing eases into place or jumps there.
Refit
Whether the view still owes the drawing a fit-to-content framing.

Constants§

CAMERA_SLACK 🔒
The slack the camera framings leave around their rect, as a fraction of the content’s size per side — a quarter of the content overall.
FIT_BORDER_CELLS 🔒
The gutter a double-click fit leaves around the content, in grid cells, so the outermost blocks don’t sit against the viewport edge.
FRAME_MAX_ZOOM 🔒
Largest zoom a framing will apply — the navigator focusing one block, or a double-click fitting the level’s contents. Small content would otherwise balloon to fill the view, which reads as a jump rather than a fit. Explicit camera rects are not capped: a caller asking for a ten-cell window means it.
LONGEST_EASED_FRAME 🔒
The longest a frame counts for when a framing eases: a frame that stalled moves the camera as far as a tenth of a second would, not as far as the stall.
VIEW_ANIMATION_RATE 🔒
Exponential approach rate for an animated view change; higher is snappier.

Functions§

overshoot 🔒
How far a span reaching from lo to hi must move along one axis to sit inside visible_lo..visible_hi. Zero when it already does; assumes it fits, so it never has to choose which end to leave outside.