Skip to main content

Module bridge

Module bridge 

Source
Expand description

The bridge between world pixels and the document’s own integer geometry, encoded once (the conversion table in docs/op-emitter-playbook.md). Each op emitter lands the rows it consumes through these, and the geometry layer reads them back through the same functions, so a rect drawn and a rect committed cannot disagree about where a cell is.

Functions§

artwork_rect
The inverse of screen_rect.
grid_point
A world-space gesture point onto the grid cell nearest it.
grid_rect
The grid rect a two-corner gesture drew — either corner may be either end of the drag.
grid_size_ceil
A world-space extent as the whole cells that fully enclose it — the measured size a text box records.
grid_vec
A drag delta as the whole-cell offset the move commits at.
px_point
The world-space corner of a grid cell — the inverse of grid_point.
px_rect
The world-space rect a grid rect covers.
px_vec
The world-space vector a snapped grid_vec covers — what artwork riding a grid move (a block’s icon) translates by.
screen_rect
Artwork geometry — free-floating images and block icons — is the one float rect the document stores: unsnapped, so a placed image keeps the aspect the drag gave it.