diff --git a/common/src/app/common/logic/libraries.cljc b/common/src/app/common/logic/libraries.cljc index ecf0533919..50ffef6c31 100644 --- a/common/src/app/common/logic/libraries.cljc +++ b/common/src/app/common/logic/libraries.cljc @@ -1458,6 +1458,13 @@ (and main (some #(not= (get shape %) (get main %)) [:constraints-h :constraints-v :fixed-scroll])) (update :touched ctk/set-touched-group :constraints-group)))) +(defn- same-pushed-value? + "Whether a pushed shape's `value` of `attr` shows as its reference's + `other`: no fills or strokes and an empty list of them look the same." + [attr value other] + (or (= value other) + (and (#{:fills :strokes} attr) (empty? value) (empty? other)))) + (defn- author-pushed-content "Taking a new content reference makes the pushed differences authored. Placement still follows the position, and existing overrides survive." @@ -1472,7 +1479,7 @@ (not (contains? placement-groups group)) (not= attr :position-data) (not (and text? (= attr :content))) - (not= (get shape attr) (get reference attr))) + (not (same-pushed-value? attr (get shape attr) (get reference attr)))) group)))) updatable-attrs) text-groups (when text? diff --git a/common/test/common_tests/logic/composable_gen_test.cljc b/common/test/common_tests/logic/composable_gen_test.cljc index ea50fc6e49..57d5d1460a 100644 --- a/common/test/common_tests/logic/composable_gen_test.cljc +++ b/common/test/common_tests/logic/composable_gen_test.cljc @@ -4308,6 +4308,13 @@ :grid-empty false :layout-copies false :text true}] :ops [[:switch 11] [:switch 5] [:nest 17] [:add-child 15] [:rotate 15] [:style 12 9 1] [:paste 12]]})))) +(t/deftest generated-an-update-main-of-a-pasted-swap-authors-no-empty-fills + ;; a pasted copy holds empty fill and stroke lists where its main holds + ;; none; pushing it to the main overrides nothing the two show alike + (t/is (map? (cg/run {:world [3 2 {:variants true :rich-variants true}] + :ops [[:variant-property 0 16 0 0] [:switch 12] [:remove-child 0 0 0 0] + [:add-variant 0 0 0 0] [:paste 12 0 0 0] [:update-main 3 0 0 0]]})))) + (t/deftest generated-an-absolute-fill-board-in-a-grid-keeps-its-size ;; a grid board set to fill a grid cell and then made absolute is no longer ;; filled by that grid: its layout settles at its size