🐛 Fix error when deleting all children of a nested group

This commit is contained in:
Andrés Moya 2022-03-30 16:02:12 +02:00 committed by Andrey Antukh
parent 134265094c
commit f782a7027a

View file

@ -410,8 +410,8 @@
(fn [changes parent]
(let [children (->> parent :shapes (map (d/getf objects)))
resized-parent (cond
(empty? children)
changes
(empty? children) ;; a parent with no children will be deleted,
nil ;; so it does not need resize
(= (:type parent) :bool)
(gshb/update-bool-selrect parent children objects)
@ -419,9 +419,9 @@
(= (:type parent) :group)
(if (:masked-group? parent)
(gsh/update-mask-selrect parent children)
(gsh/update-group-selrect parent children)))
{rops :rops uops :uops}
(gsh/update-group-selrect parent children)))]
(if resized-parent
(let [{rops :rops uops :uops}
(reduce #(generate-operation %1 %2 parent resized-parent)
{:rops [] :uops []}
(keys parent))
@ -434,6 +434,7 @@
(-> changes
(update :redo-changes conj (assoc change :operations rops))
(update :undo-changes d/preconj (assoc change :operations uops)))
changes))
changes)))]
(-> (reduce resize-parent changes all-parents)