🐛 Lay out the parents of an unmasked group again

Unmasking a group gives it the bounds of all its children instead of its
mask's, but the event did not update the layout the group is in, so in a
flex or grid board it kept the place of its old bounds and overlapped its
neighbours. It now updates the layouts of the groups' parents, as group,
mask and ungroup do.

The benchmark covers JVM code; this change is ClojureScript only, so it
is not run.

AI-assisted-by: claude-opus-5-5
This commit is contained in:
alonso.torres 2026-11-14 23:49:21 +01:00
parent 468aaea5ca
commit d659ab3b9e
2 changed files with 14 additions and 4 deletions

View File

@ -119,8 +119,11 @@
(watch [it state _]
(let [page-id (:current-page-id state)
objects (dsh/lookup-page-objects state page-id)
ids (d/nilv ids (dsh/lookup-selected state))
;; an unmasked group takes the bounds of all its children, which
;; the layout it is in places again
parents (into #{} (keep #(:parent-id (get objects %))) ids)
changes (clg/generate-unmask-changes it page-id objects ids)]
changes (clg/generate-unmask-changes it page-id objects
(d/nilv ids (dsh/lookup-selected state)))]
(rx/of (dch/commit-changes changes)))))))
(rx/of (dch/commit-changes changes)
(ptk/data-event :layout/update {:ids parents})))))))

View File

@ -1102,3 +1102,10 @@
[:delete 8 0 0 0] [:swap 15 0 0 0] [:edit 14 0 0 0]
[:resize 4 0 0 0] [:resize 0 0 0 0] [:nest 4 0 0 0]
[:rotate 5 0 0 0] [:update-main 14 0 0 0] [:duplicate 0 0 0 0]]})))
(t/deftest ^:async generated-an-unmask-in-a-flex-main-places-the-group-again
;; an unmasked group takes the bounds of all its children, which the flex
;; it is in places again
(await (replay {:world [2 0 {:variants false :rich-variants false :text true :layout :flex
:layout-copies false :layout-children true}]
:ops [[:structure 11 1 13] [:structure 0 3]]})))