0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-24 23:49:45 -05:00

🐛 Fix resize parents when there are nested groups

This commit is contained in:
Andrés Moya 2022-06-07 13:05:30 +02:00 committed by Alonso Torres
parent 1764d965c1
commit 71501d966c

View file

@ -372,8 +372,8 @@
(assert-page-id changes)
(assert-objects changes)
(let [page-id (::page-id (meta changes))
objects (lookup-objects changes)
objects (lookup-objects changes)
xform (comp
(mapcat #(cons % (cph/get-parent-ids objects %)))
(map (d/getf objects))
@ -409,7 +409,8 @@
resize-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
(empty? children) ;; a parent with no children will be deleted,
nil ;; so it does not need resize
@ -434,12 +435,12 @@
(if (seq rops)
(-> changes
(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)))]
(-> (reduce resize-parent changes all-parents)
(apply-changes-local))))
(reduce resize-parent changes all-parents)))
;; Library changes