Skip to main content

Module zoom

Module zoom 

Source
Expand description

The canvas world→screen scale, constrained to the range the view ever legitimately reaches: framing clamps to [0.1, 10] and wheel zoom to a narrower band inside it. The type guarantees the scale is positive, so screen↔world division is always sound.

Structs§

Factor
What a zoom is multiplied by: a wheel notch, a pinch, a keyboard step. Above one magnifies.
ScrollPx
A wheel notch as a host reports it: the screen pixels the diagram was asked to scroll up by. Hosts disagree on the sign of a wheel, so each states its own in this type’s terms and none of them states the rate.
Zoom
A newtype rather than a Bounded<ZoomBounds> alias so Zoom::unity can be inherent; the clamping and the total order are Bounded’s.
ZoomBounds

Enums§

ZoomStep
One keyboard zoom step’s direction — the parameter form of “which way”, so a call site reads ZoomStep::In rather than a bare sign or factor.

Constants§

SCROLL_ZOOM_RATE 🔒
Zoom factor exponent per pixel of scroll. One rate, so a wheel notch means the same thing whichever host read it.