diff --git a/common/src/app/common/logic/libraries.cljc b/common/src/app/common/logic/libraries.cljc index b13132985e..c589d9bb70 100644 --- a/common/src/app/common/logic/libraries.cljc +++ b/common/src/app/common/logic/libraries.cljc @@ -569,7 +569,9 @@ objects (let [modif-tree (gm/set-objects-modifiers {(:id shape-main) {:modifiers (ctm/change-size shape-main width height)}} - (reduce-kv #(d/update-when %1 %2 merge %3) objects authored))] + ;; the copy keeps its own size, which no layout of the main owns + (-> (reduce-kv #(d/update-when %1 %2 merge %3) objects authored) + (assoc-in [(:id shape-main) :layout-item-absolute] true)))] (reduce-kv (fn [objects id {:keys [modifiers]}] (d/update-when objects id gsh/transform-shape modifiers)) objects diff --git a/common/test/common_tests/logic/composable_gen_test.cljc b/common/test/common_tests/logic/composable_gen_test.cljc index 1b1d486a93..8c620997ad 100644 --- a/common/test/common_tests/logic/composable_gen_test.cljc +++ b/common/test/common_tests/logic/composable_gen_test.cljc @@ -973,3 +973,10 @@ (t/is (map? (cg/run {:world [2 0 {:variants true :text-styles true :library true :rich-variants true :layout-copies true :text true}] :ops [[:switch 3 0 0 0] [:nest 9 0 0 0] [:edit 7 1 1 :copy-head] [:reset 7]]})))) + +(t/deftest generated-copy-with-its-own-geometry-keeps-children-of-a-main-set-to-fill + ;; a nested copy made absolute in a copy keeps its size when its main is + ;; set to fill a grid; its children stay where the copy has them + (t/is (map? (cg/run {:world [2 2 {:variants true :text-styles true :layout :grid :variant-diff false + :rich-variants true :grid-empty true :layout-copies true :text true}] + :ops [[:style 1 35 1] [:style 0 29 1]]}))))