mirror of
https://github.com/storytold/figcraft.git
synced 2026-11-29 01:34:37 +01:00
M2: auto layout parity wording for the measured Add auto layout defaults
Row 96 still said a frame with content hugs it before stating the measured rule, and the group paragraph's "therefore" followed the new clause. Docs only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Model-Effort: Opus 5.5 drove and wrote
This commit is contained in:
1 parent
0ac4e22dda
commit
024281136a
1 file changed
+2
-2
@@ -15,7 +15,7 @@ With one group selected, Add auto layout converts that group into a frame in pla
|
||||
id, name, parent and direct children. The Layout sidebar’s +, context menu, Shift+A and API calls
|
||||
all dispatch `layout.add`, so they share the conversion and a single undo step restores the group.
|
||||
The layout settings are inferred from visible, non-absolute children, matching the layout engine’s
|
||||
flow, with the sizing, gap and padding defaults measured in Figma (see the Add auto layout row below); a converted group follows the rule for a wrap of several layers and ends with no fill and clip off. Hidden and absolute children therefore do not distort direction, gap or padding. A converted
|
||||
flow, so hidden and absolute children do not distort direction, gap or padding. The sizing, gap and padding defaults are the ones measured in Figma (see the Add auto layout row below): a converted group follows the rule for a wrap of several layers and ends with no fill and clip off. A converted
|
||||
group keeps Fill sizing on either axis in its auto layout parent. Sorting by position preserves
|
||||
mask boundaries and the paint order within masked runs. The sidebar offers Add only when every
|
||||
selected container has no auto layout, including mixed selections.
|
||||
@@ -93,7 +93,7 @@ Status: **pass** (a case in the suite holds), **fixed** (the suite found a diver
|
||||
| Constraints: left, right, left and right, centre, scale; top/bottom likewise | done | |
|
||||
| Layout grids: columns, rows, grid; stretch/left/centre/right; variables bound | done | |
|
||||
| Suggest auto layout | done | The target works out which layers belong together and adds as many auto layout frames as the design needs, in one step, keeping the placement. `layout.suggest` used to run `layout.add` and made one row of everything (#1823). Now it splits a frame's layers, by their boxes in the frame, along the vertical axis first: sorted by top edge, a layer joins the current row while it starts above the row's bottom (or together with it), and a gap, even a zero one, between the row and the next layer starts a new row. With two or more rows the frame becomes a Vertical auto layout whose items are the rows; otherwise the same split by columns gives a Horizontal one; if the layers overlap along both axes the frame gets no auto layout and the result carries a warning. A row or column of several layers goes into a new frame without fill or clipping, sized to it and inserted in its place (it hugs its content once the split gives it auto layout; a band whose own layers overlap along both axes gets none, with a warning, and stays a Fixed frame that cannot reflow those layers), and the split repeats inside it, to a depth of 16 and for up to 1,000 layers per frame (past that, or when a mask is among the layers, the layers are laid out in one list as Add auto layout does, with a warning). The frame keeps its size, Fixed: the gap is the distance between the bands, the padding along the flow is the first band's offset and the room left after the last, across the flow the smallest offset (alignment start), so with equal gaps and bands that start at the same offset every layer keeps its box exactly. When the gaps differ by more than 0.5 px the smallest is used and `warnings` says the later bands move; when the bands start at different offsets across the flow (a centred title above a card) they line up at the smallest, which moves the others, and `warnings` says so. Instances and layers inside them are refused with the error Convert to group gives, before anything changes; a main component works. `direction` sets the top level only. A single group becomes a frame in place and several layers are wrapped in a frame (both hug), as Add auto layout does; a frame with fewer than two layers is laid out as Add auto layout does. One undo step. Tests in `crates/engine/src/layout_suggest_tests.rs`: `two_rows_of_two_squares_become_a_vertical_frame_of_two_horizontal_rows`, `suggesting_auto_layout_is_one_undo_step`, `three_squares_in_a_row_get_one_horizontal_layout_without_nesting`, `three_squares_in_a_column_get_one_vertical_layout_without_nesting`, `a_header_above_two_columns_of_squares_gives_a_row_per_line`, `a_header_above_a_tall_layer_beside_a_column_nests_three_levels`, `unequal_gaps_use_the_smallest_and_say_so`, `overlapping_layers_leave_the_frame_without_auto_layout_and_say_so`, `a_group_becomes_a_frame_in_place_and_follows_the_rules`, `several_layers_are_wrapped_in_a_frame_that_is_then_split`, `a_direction_forces_the_top_level_and_nested_frames_follow_the_gaps`, `a_frame_with_one_layer_is_laid_out_like_add_auto_layout`, `add_auto_layout_still_makes_a_single_row`, `a_centred_title_above_a_card_is_lined_up_at_the_card_edge_with_a_warning`, `instances_and_layers_inside_them_are_refused_and_a_main_component_works`. Not attempted: overlapping layers, keeping uneven offsets across the flow (they line up at the smallest, with a warning), grids |
|
||||
| "Add auto layout" on a selection | done | the Layout sidebar exposes Add auto layout (+) for groups and frames using the same `layout.add` command as the context menu; a single group becomes a frame in place, keeping its id, name and direct children; adding auto layout to an empty frame keeps its size, Fixed (it collapsed to 20×20); a frame with content still hugs it, as does a new frame wrapped around a selection (#369). Add auto layout on a selection follows the defaults measured in Figma's web app with synthetic rectangles, 2026-11-09 (`al_behaviour_tests::shift_a_*`): the height hugs; the width is fixed in a vertical flow (a converted frame shrinks to its content plus the left and right padding) and with an Auto gap, and hugs otherwise; the gap is Auto (main align Space between, the measured gap stored) only in a horizontal flow of exactly two layers whose gap is at least the narrower layer's width (for a converted frame also with equal left and right offsets within 0.5 px), otherwise the rounded mean of the gaps; a converted frame takes the content's left offset for left and right padding and its top offset for top and bottom, a wrap of several layers has no padding, and a wrap of one layer pads 10 on every side with a gap of 10, hugs both ways and keeps the layer in place on the canvas (converting a frame with one child is unmeasured and unchanged). `node.set` with auto layout keys on a mix of layers applies them to the frames and warns about the rest instead of failing the whole call (#603) |
|
||||
| "Add auto layout" on a selection | done | the Layout sidebar exposes Add auto layout (+) for groups and frames using the same `layout.add` command as the context menu; a single group becomes a frame in place, keeping its id, name and direct children; adding auto layout to an empty frame keeps its size, Fixed (it collapsed to 20×20, #369). A frame with content, and a new frame wrapped around a selection, take the defaults measured in Figma's web app with synthetic rectangles, 2026-11-09 (`al_behaviour_tests::shift_a_*`): the height hugs; the width is fixed in a vertical flow (a converted frame shrinks to its content plus the left and right padding) and with an Auto gap, and hugs otherwise; the gap is Auto (main align Space between, the measured gap stored) only in a horizontal flow of exactly two layers whose gap is at least the narrower layer's width (for a converted frame also with equal left and right offsets within 0.5 px), otherwise the rounded mean of the gaps; a converted frame takes the content's left offset for left and right padding and its top offset for top and bottom, a wrap of several layers has no padding, and a wrap of one layer pads 10 on every side with a gap of 10, hugs both ways and keeps the layer in place on the canvas (converting a frame with one child is unmeasured and unchanged). `node.set` with auto layout keys on a mix of layers applies them to the frames and warns about the rest instead of failing the whole call (#603) |
|
||||
| Real Figma files laid out identically | **not checked** | needs `.fig` or REST import of real files ([gaps](gaps.md) #1, #3) |
|
||||
| Performance: re-flow only where sizes or places changed | done | measured in `cargo xtask bench` (components at scale) |
|
||||
|
||||
|
||||
Reference in new issue
Block a user