mirror of
https://github.com/penpot/penpot.git
synced 2025-01-27 00:49:28 -05:00
🐛 Fix resize parents when there are nested groups
This commit is contained in:
parent
1764d965c1
commit
71501d966c
1 changed files with 6 additions and 5 deletions
|
@ -372,8 +372,8 @@
|
||||||
(assert-page-id changes)
|
(assert-page-id changes)
|
||||||
(assert-objects changes)
|
(assert-objects changes)
|
||||||
(let [page-id (::page-id (meta changes))
|
(let [page-id (::page-id (meta changes))
|
||||||
objects (lookup-objects changes)
|
|
||||||
|
|
||||||
|
objects (lookup-objects changes)
|
||||||
xform (comp
|
xform (comp
|
||||||
(mapcat #(cons % (cph/get-parent-ids objects %)))
|
(mapcat #(cons % (cph/get-parent-ids objects %)))
|
||||||
(map (d/getf objects))
|
(map (d/getf objects))
|
||||||
|
@ -409,7 +409,8 @@
|
||||||
|
|
||||||
resize-parent
|
resize-parent
|
||||||
(fn [changes parent]
|
(fn [changes parent]
|
||||||
(let [children (->> parent :shapes (map (d/getf objects)))
|
(let [objects (lookup-objects changes)
|
||||||
|
children (->> parent :shapes (map (d/getf objects)))
|
||||||
resized-parent (cond
|
resized-parent (cond
|
||||||
(empty? children) ;; a parent with no children will be deleted,
|
(empty? children) ;; a parent with no children will be deleted,
|
||||||
nil ;; so it does not need resize
|
nil ;; so it does not need resize
|
||||||
|
@ -434,12 +435,12 @@
|
||||||
(if (seq rops)
|
(if (seq rops)
|
||||||
(-> changes
|
(-> changes
|
||||||
(update :redo-changes conj (assoc change :operations rops))
|
(update :redo-changes conj (assoc change :operations rops))
|
||||||
(update :undo-changes d/preconj (assoc change :operations uops)))
|
(update :undo-changes d/preconj (assoc change :operations uops))
|
||||||
|
(apply-changes-local))
|
||||||
changes))
|
changes))
|
||||||
changes)))]
|
changes)))]
|
||||||
|
|
||||||
(-> (reduce resize-parent changes all-parents)
|
(reduce resize-parent changes all-parents)))
|
||||||
(apply-changes-local))))
|
|
||||||
|
|
||||||
;; Library changes
|
;; Library changes
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue