Skip to main content

Module layout

Module layout 

Source
Expand description

Pure layout math for the justified-row masonry grid.

pack_rows greedily fills rows up to canvas_w then scales each row to fit. Includes O(log n) row lookup helpers used by the snapshot + hit-test paths.

Structsยง

LaidItem
LaidRow
LayoutConfig

Constantsยง

FALLBACK_H ๐Ÿ”’
FALLBACK_W ๐Ÿ”’
GAP ๐Ÿ”’
MAX_ROW_HEIGHT_COMPACT ๐Ÿ”’
MAX_ROW_HEIGHT_NARROW ๐Ÿ”’
MAX_ROW_HEIGHT_WIDE ๐Ÿ”’
MIN_ROW_HEIGHT_COMPACT ๐Ÿ”’
MIN_ROW_HEIGHT_NARROW ๐Ÿ”’
MIN_ROW_HEIGHT_WIDE ๐Ÿ”’

Functionsยง

aspect ๐Ÿ”’
build_row ๐Ÿ”’
Scale, clamp, and place items into a single laid-out row.
collect_row_indices ๐Ÿ”’
Greedily collect item indices that fit into a single row at max height.
first_row_at_or_after ๐Ÿ”’
item_at_x ๐Ÿ”’
pack_rows ๐Ÿ”’
Greedy justified-row pack. dims[i] = (w, h) for asset i.
row_at_y ๐Ÿ”’
scale_to_fit ๐Ÿ”’