diff --git a/common/src/app/common/logic/libraries.cljc b/common/src/app/common/logic/libraries.cljc index cc91a5a61a..f9f25282b5 100644 --- a/common/src/app/common/logic/libraries.cljc +++ b/common/src/app/common/logic/libraries.cljc @@ -1907,8 +1907,11 @@ it to them meanwhile, while it keeps the transform the change gave it, rewrites geometry the change did not touch." [changes dest-shape container roperations uoperations] - (let [update-parents {:type :reg-objects - :shapes (cfh/get-parent-ids (:objects container) (:id dest-shape))} + (let [;; a masked group takes all its geometry from its mask, so it fits + ;; its mask again after taking its main's + update-parents {:type :reg-objects + :shapes (cond->> (vec (cfh/get-parent-ids (:objects container) (:id dest-shape))) + (:masked-group dest-shape) (into [(:id dest-shape)]))} undone (into #{} (map :attr) uoperations) uoperations (cond-> (vec uoperations) (and (#{:group :bool} (:type dest-shape)) diff --git a/common/test/common_tests/logic/composable_gen_test.cljc b/common/test/common_tests/logic/composable_gen_test.cljc index 65858e96bb..324d9c3fca 100644 --- a/common/test/common_tests/logic/composable_gen_test.cljc +++ b/common/test/common_tests/logic/composable_gen_test.cljc @@ -2495,6 +2495,13 @@ :ops [[:variant-property 0 9 3 0] [:switch 4] [:combine 2] [:switch 8] [:style 11 7 1] [:update-main 2 0 0 0]]})))) +(t/deftest a-synced-masked-group-fits-the-mask-its-copy-turned + ;; a copy turns the mask of a masked group; a sync gives the group its + ;; main's geometry and then fits it to the turned mask again + (t/is (map? (cg/run {:world [2 0 {:variants true :rich-variants true :text true :layout nil :layout-copies true + :layout-children false}] + :ops [[:add-child 1] [:structure 3 1 0] [:transform 2 3 0 2]]})))) + (t/deftest a-pasted-copy-compares-with-the-main-the-file-accepted ;; the library widened a main the stale file has not accepted: a copy ;; pasted from it shows the accepted size, which is no override