Skip to main content

Module lower

Module lower 

Source
Expand description

The editor’s own rules about grid geometry: the block-height ladder, a block’s pin capacity, the accent↔role mapping the pickers speak, and the label and asset reads the shapes draw from. The coordinate conversions these build on are crate::grid’s, so a rect drawn and a rect committed cannot disagree about where a cell is.

Functions§

accent_from_role
The inverse of role_from_accent, for projections back into the picker’s vocabulary.
asset_within_limit
Whether asset is small enough to ride the commit log; logs name and both sizes when it is not. The fold refuses one too, but only after a gesture has authored it — refusing here is what lets the pick that produced it say so.
block_rect
grid_rect on a block’s height ladder: heights are one of 4, 7, 10, … cells (a pin slot’s clearance plus one pitch per slot), and the top edge is kept, so the block settles onto the nearest valid height rather than the one the drag stopped at.
role_from_accent
The picker’s accent pick — None = plain, Some(0..=7) = palette index — onto the 9-variant Role, where Accent0 is the meaningful plain default. Indices past the palette cannot come from the picker; they saturate to the last accent rather than silently reading as plain.
shape_label
A Label namespace read out for drawing. The one register the geometry layer cannot use as stored is offset: the document keeps it fixed-point (so its bytes are deterministic), while every anchor formula works in world pixels — the same pixels the drag wrote, since FracVal::from(f32) is what put it there.
slot_capacity
The highest slot a block height cells tall offers; the ladder itself lives in max_pin_slot, which works in px.