diff --git a/common/src/app/common/logic/libraries.cljc b/common/src/app/common/logic/libraries.cljc index 97fa704c0d..af75c0484b 100644 --- a/common/src/app/common/logic/libraries.cljc +++ b/common/src/app/common/logic/libraries.cljc @@ -1422,9 +1422,9 @@ placed (when (and position (not (ctk/swapped? head))) (placed-like position-objects position head (authored-constraints by-id (cfh/get-children-ids by-id (:id head))))) - ;; the shapes that keep their pushed geometry: the head and the subtrees of those that author theirs + ;; the shapes that keep their pushed geometry: the head and the subtrees of those that author theirs or are swapped kept-ids (into #{(:id head)} - (comp (filter #(ctk/touched-group? % :geometry-group)) + (comp (filter #(or (ctk/touched-group? % :geometry-group) (ctk/swapped? %))) (mapcat #(cfh/get-children-ids-with-self by-id (:id %)))) positioned) follow-position (fn [shape] diff --git a/common/test/common_tests/logic/composable_gen_test.cljc b/common/test/common_tests/logic/composable_gen_test.cljc index 164b92321f..1d5ad95306 100644 --- a/common/test/common_tests/logic/composable_gen_test.cljc +++ b/common/test/common_tests/logic/composable_gen_test.cljc @@ -2387,6 +2387,13 @@ :layout-copies false :text false}] :ops [[:grid-track 10 5 0 11] [:grid-track 0 1] [:grid-cell 0 0 0 1]]})))) +(t/deftest updating-a-main-pushes-a-swapped-shape-nested-in-a-swap-with-its-children + (t/is (map? (cg/run {:world [3 3 {:variants true :text-styles true :scale true :layout :flex :variant-diff true + :grid-square false :copies 5 :rich-variants true :layout-children true + :grid-empty false :layout-copies false :text true}] + :ops [[:delete] [:restore] [:combine 21] [:swap 24] [:switch 27] [:rotate 14] [:switch 11] + [:combine 11] [:switch 6] [:switch 5] [:edit 16] [:edit 0 0 0 1] [:update-main 24]]})))) + (t/deftest random-shape-structure-compositions (let [coverage (atom {}) failure (atom nil)]