diff --git a/common/src/app/common/logic/libraries.cljc b/common/src/app/common/logic/libraries.cljc index c8907394b5..b4aa7c84d8 100644 --- a/common/src/app/common/logic/libraries.cljc +++ b/common/src/app/common/logic/libraries.cljc @@ -1213,9 +1213,13 @@ main-container (when main (main-in-parent-orientation (:container (meta main)) main container shape false)) - expected (get-in main-container [:objects (:id main)])] + expected (get-in main-container [:objects (:id main)]) + ;; a mirrored shape can store another rotation for the same axes + turned? (and expected + (not (gmt/unit? (gmt/multiply (axes-matrix expected) + (gmt/inverse (axes-matrix shape))))))] (cond-> shape - (and expected (orient-like shape expected (gsh/shape->center shape))) + turned? (update :touched ctk/set-touched-group :geometry-group) (and main (some #(not= (get shape %) (get main %)) [:constraints-h :constraints-v :fixed-scroll])) diff --git a/common/test/common_tests/logic/composable_gen_test.cljc b/common/test/common_tests/logic/composable_gen_test.cljc index 28d12c3702..c4631f2aad 100644 --- a/common/test/common_tests/logic/composable_gen_test.cljc +++ b/common/test/common_tests/logic/composable_gen_test.cljc @@ -2116,6 +2116,15 @@ :ops [[:variant-property] [:switch 3] [:combine 11] [:combine 12] [:resize 10] [:variant-property 8 9] [:add-variant] [:switch 2] [:update-main]]})))) +(t/deftest updating-a-main-from-a-mirrored-copy-pushes-its-swap-without-a-geometry-override + (t/is (map? (cg/run {:world [3 2 {:variants true :text-styles true :layout nil :variant-diff false + :layout-item-margins false :grid-square true :rich-variants true + :layout-children true :grid-empty false :layout-copies true :text false}] + :ops [[:swap 6 5 0] [:add-variant 4 5 3] [:make-variant 4] [:make-variant 0 1 5] + [:make-variant 1] [:switch 2] [:detach 0 2 6] [:combine] [:swap 2 2 0] [:switch] + [:nest 6 3 3] [:add-variant 1 5 5] [:rotate 0 4 5] [:nest 3 3 4] [:switch] + [:switch] [:transform 0 4 0 2] [:update-main]]})))) + (t/deftest moving-a-flex-copy-child-after-a-switch-resized-its-sibling-authors-no-geometry (t/is (map? (cg/run {:world [1 2 {:variants true :text-styles false :layout :flex :variant-diff false :layout-item-margins false :grid-square false :rich-variants true