diff --git a/common/src/app/common/logic/bool.cljc b/common/src/app/common/logic/bool.cljc index 129fdb280b..047c786751 100644 --- a/common/src/app/common/logic/bool.cljc +++ b/common/src/app/common/logic/bool.cljc @@ -131,4 +131,6 @@ [parent-id] (fn [parent] (assoc-in parent [:layout-grid-cells (:id target-cell) :shapes] [shape-id])))) - (pcb/update-shapes grid-parents ctl/assign-cells {:with-objects? true}))])))) + (pcb/update-shapes grid-parents ctl/assign-cells {:with-objects? true}) + ;; the groups around the bool take the bounds of its result + (pcb/resize-parents [shape-id]))])))) diff --git a/common/test/common_tests/logic/composable_gen_test.cljc b/common/test/common_tests/logic/composable_gen_test.cljc index 367f4c6f56..4832e704c0 100644 --- a/common/test/common_tests/logic/composable_gen_test.cljc +++ b/common/test/common_tests/logic/composable_gen_test.cljc @@ -2467,6 +2467,11 @@ [:add-child 0 0 0 0] [:add-child 0] [:structure 14 1 0] [:rotate 15 0 0 0] [:add-child 0] [:structure 0 3 0]]})))) +(t/deftest a-bool-made-in-a-main-group-gives-the-copy-groups-its-bounds + (t/is (map? (cg/run {:world [1 0 {:variants true :rich-variants true :text false :layout :flex + :layout-copies false :layout-children false}] + :ops [[:delete] [:swap] [:add-child 1] [:structure] [:structure 4 0 1] [:structure 2 5 3]]})))) + (t/deftest random-shape-structure-compositions (let [coverage (atom {}) failure (atom nil)] diff --git a/common/test/common_tests/logic/groups_test.cljc b/common/test/common_tests/logic/groups_test.cljc index 299c5c4217..61d0936600 100644 --- a/common/test/common_tests/logic/groups_test.cljc +++ b/common/test/common_tests/logic/groups_test.cljc @@ -144,3 +144,15 @@ tree (gm/set-objects-modifiers {(:id bool) {:modifiers (ctm/change-size bool 80 nil)}} objects) rect (gsh/transform-shape (get objects (thi/id :rect)) (get-in tree [(thi/id :rect) :modifiers]))] (t/is (mth/close? 80 (-> rect :selrect :width))))) + +(t/deftest a-bool-made-in-a-group-gives-the-group-its-bounds + (let [file (-> (thf/sample-file :file1) + (ths/add-sample-shape :badge :width 12 :height 12) + (ths/add-sample-shape :rect :x 10 :y 10 :width 20 :height 20)) + [id file] (group file [:badge :rect]) + page (thf/current-page file) + [shape changes] (clb/generate-create-bool nil (:id page) (:objects page) + [(thi/id :badge) (thi/id :rect)] :difference nil) + objects (objects (thf/apply-changes file changes))] + (t/is (= (-> (get objects (:id shape)) :selrect ((juxt :x :y :width :height))) + (-> (get objects id) :selrect ((juxt :x :y :width :height)))))))