diff --git a/common/src/app/common/logic/swap.cljc b/common/src/app/common/logic/swap.cljc index 3bf1217733..cd3336a3da 100644 --- a/common/src/app/common/logic/swap.cljc +++ b/common/src/app/common/logic/swap.cljc @@ -175,8 +175,11 @@ ;; If the attribute is not valid for the destiny, don't copy it (not (cts/is-allowed-switch-keep-attr? attr (:type current-shape))) - ;; If the values are already equal, don't copy them - (= (get previous-shape attr) (get current-shape attr)) + ;; If the values are already equal, don't copy them; geometry + ;; within its precision + (if (= sync-group :geometry-group) + (gsh/close-attrs? attr (get previous-shape attr) (get current-shape attr)) + (= (get previous-shape attr) (get current-shape attr))) ;; If :selrect/:points values are already equal ignoring displacement, ;; don't copy them diff --git a/common/test/common_tests/logic/composable_gen_test.cljc b/common/test/common_tests/logic/composable_gen_test.cljc index 1010dc1dce..dd058efafb 100644 --- a/common/test/common_tests/logic/composable_gen_test.cljc +++ b/common/test/common_tests/logic/composable_gen_test.cljc @@ -1197,3 +1197,16 @@ :layout-item-margins false :grid-square false :rich-variants true :layout-children false :grid-empty true :layout-copies true :text true}] :ops [[:style 0 29 1] [:nest 9 0 0 0] [:duplicate 5 1 0 0]]}))))) + +(t/deftest generated-switch-carries-no-geometry-the-new-copy-already-shows + ;; a switched head inherits a turn its new copy already shows up to float + ;; noise in the transform; the switch carries no geometry override for it + (t/is (map? (cg/run {:world [2 2 {:variants true :text-styles true :layout nil :layout-item-margins false + :grid-square false :library true :rich-variants true :layout-children false + :grid-empty false :layout-copies true :text true}] + :ops [[:nest 6 0 0 0] [:rotate 21 0 0 0] [:duplicate 21 0 0 0] [:switch 0 0 0 0] + [:switch 0 0 0 0] [:edit 6 0 1 1] [:update-main 6] [:switch 9 0 0 0]]}))) + (t/is (map? (cg/run {:world [2 2 {:variants true :text-styles true :layout nil :variant-diff false + :layout-item-margins false :grid-square false :rich-variants true + :layout-children false :grid-empty false :layout-copies true :text true}] + :ops [[:rotate 0 0 0 0] [:update-main 0 0 0 0] [:resize 0 0 0 0] [:switch 4 0 0 0]]}))))