Skip to main content

Module ruler

Module ruler 

Source
Expand description

The ruler’s arithmetic, without egui: which steps its ticks and labels take at a zoom, where they go, and what snapping lands on.

Structs§

Mark
A tick of the ruler.
SnapTargets
Points a time is pulled to, with what each is.
Ticks
The ruler’s steps at a zoom, in seconds: a label at each major tick, a short tick at each minor one (the grid snapping lands on).

Enums§

Snapped
What a time snapped to.

Constants§

LABEL_GAP
The room kept between two labels, in points.
LABEL_INSET
Where a label starts after its tick, in points.
MIN_TICK_GAP
The least room between two minor ticks, in points.

Functions§

marks
The ticks in view and their labels.
snap
time snapped: to the nearest point within reach seconds, else to the grid when there is one, else onto the scale’s units.
snap_span
Where a span length long starting near start snaps: whichever of its edges is nearer a point within reach lands on it; otherwise its start goes onto the grid (or the scale’s units). Its new start, and what it snapped to.
ticks
The steps the ruler takes for view across width points: the finest whose labels, measured by measure (their width in points), never overlap; and under it the finest grid that divides it and keeps MIN_TICK_GAP.