diff --git a/common/src/app/common/geom/modifiers.cljc b/common/src/app/common/geom/modifiers.cljc index 49cdd21a72..73e1b1874a 100644 --- a/common/src/app/common/geom/modifiers.cljc +++ b/common/src/app/common/geom/modifiers.cljc @@ -223,7 +223,8 @@ "Calculates the modifiers to adjust the bounds for auto-width/auto-height shapes. A fill child of a grid takes the size of its content, unless it is turned in the grid: the grid's fill then sizes it along the grid's - axes, and its content's size counts as its minimum there." + axes, and its content's size counts as its minimum there. An absolute + child keeps its size: the grid does not fill it." [objects bounds parent] (let [parent-id (:id parent) parent-bounds (get bounds parent-id) @@ -250,7 +251,9 @@ (remove ctl/position-absolute?) (remove gco/invalid-geometry?)) + ;; an absolute child is neither placed nor filled by the grid grid-fill? (and (ctl/grid-layout? objects (:parent-id parent)) + (not (ctl/position-absolute? parent)) (not (turned-in-parent? objects bounds parent-id))) auto? (or (ctl/auto? parent) (and grid-fill? (ctl/fill? parent))) diff --git a/common/test/common_tests/logic/composable_gen_test.cljc b/common/test/common_tests/logic/composable_gen_test.cljc index 5832bfb712..ea50fc6e49 100644 --- a/common/test/common_tests/logic/composable_gen_test.cljc +++ b/common/test/common_tests/logic/composable_gen_test.cljc @@ -4308,6 +4308,13 @@ :grid-empty false :layout-copies false :text true}] :ops [[:switch 11] [:switch 5] [:nest 17] [:add-child 15] [:rotate 15] [:style 12 9 1] [:paste 12]]})))) +(t/deftest generated-an-absolute-fill-board-in-a-grid-keeps-its-size + ;; a grid board set to fill a grid cell and then made absolute is no longer + ;; filled by that grid: its layout settles at its size + (t/is (map? (cg/run {:world [2 1 {:variants true :text-styles true :layout :grid :library true + :rich-variants true :layout-children true :layout-copies true :text true}] + :ops [[:remove-child 5 0 0 0] [:style 2 29 1] [:style 5 35 1]]})))) + (t/deftest generated-an-ungroup-gives-a-grid-copy-with-its-own-cells-its-main-tracks ;; a grid copy with its own cells and direction but its main's tracks ;; takes the tracks an ungroup in the main adds before placing the shapes