diff --git a/common/src/app/common/logic/libraries.cljc b/common/src/app/common/logic/libraries.cljc index 12ab7fb0b5..3154612828 100644 --- a/common/src/app/common/logic/libraries.cljc +++ b/common/src/app/common/logic/libraries.cljc @@ -550,11 +550,17 @@ (gpt/point (-> root-inst :selrect :x) (-> root-inst :selrect :y)))] (gsh/move shape delta))) +(declare flips) + (defn- close-geometry? + "Whether `shape` and `other` have the same geometry: a bool keeps its + corners in one order whatever its flips, so they count too." [shape other] (and (gsh/close-attrs? :selrect (:selrect shape) (:selrect other)) (gsh/close-attrs? :points (:points shape) (:points other)) - (mth/close? (:content-scale shape 1) (:content-scale other 1)))) + (mth/close? (:content-scale shape 1) (:content-scale other 1)) + (or (not (#{:group :bool} (:type shape))) + (= (flips shape) (flips other))))) (defn- authored-constraints "The constraints that the copy shapes `ids` author, by the id of the main diff --git a/common/test/common_tests/logic/composable_gen_test.cljc b/common/test/common_tests/logic/composable_gen_test.cljc index adf5c584b0..ead5e8b0d0 100644 --- a/common/test/common_tests/logic/composable_gen_test.cljc +++ b/common/test/common_tests/logic/composable_gen_test.cljc @@ -2519,6 +2519,11 @@ :layout-copies false :layout-children false}] :ops [[:structure 1 1 1] [:remove-child 1]]})))) +(t/deftest syncing-the-shapes-of-a-flipped-copy-bool-keeps-them-flipped + (t/is (map? (cg/run {:world [1 0 {:variants false :rich-variants false :text false :layout :grid + :layout-copies false :layout-children false}] + :ops [[:structure 0 4] [:transform 0 4 0 2]]})))) + (t/deftest settling-a-bool-in-a-grid-copy-twice-keeps-its-shapes-in-place (t/is (map? (cg/run {:world [3 0 {:variants true :rich-variants true :text true :layout :grid :layout-copies true :layout-children true}]