Files
figcraft/crates/layout/src
Denis Gomes 0d7eeac29d M2: A locked-ratio child filling one axis of auto layout keeps its proportions
A photo filling the width of a row (Fill container across, a fixed
height, its image cropped to the layer) was squashed when it went into
a row with a different amount of room: pasted next to a 516 pt column
instead of an 804 pt one it became 1092 by 969.15 instead of 804 by
969.15, and the cropped image stretched with it. Locking the aspect
ratio didn't help, because auto layout never read constrain_proportions.

flow_items now records the cross-per-main ratio of a child whose aspect
ratio is locked, which fills exactly one axis and is fixed on the other
(text excluded, and rotated layers too: layout reads a turned layer's
bounding box, whose ratio isn't the layer's own). Wherever the layout
sizes such a child on its filled axis (resize_fill_main_item, the
single-line cross fill before the lines are measured, and the stretch
across a hugging line), the fixed side follows at that ratio, within
its min and max; a filled side of zero leaves the fixed side as it is
rather than shrink the layer to nothing. Without the lock the fixed
side stays fixed, as before. Wrapping lines and grids are unchanged.

Figma never squashes a pasted image, lock or not. So a pasted layer
whose image is cropped to it (the one image mode that stretches with the
layer; Fill and Fit refit the image), landing in an auto layout frame
where it fills one axis and is fixed on the other, gets its aspect
ratio locked, and the layout above keeps its proportions. That includes
the instance a main component copied in its own file pastes as. Other
pasted layers keep their lock as copied.
2026-11-19 16:09:48 -05:00
..