mirror of
https://github.com/penpot/penpot.git
synced 2025-07-04 19:37:17 +02:00
🐛 Fix error when deleting all children of a nested group
This commit is contained in:
parent
134265094c
commit
f782a7027a
1 changed files with 16 additions and 15 deletions
|
@ -410,8 +410,8 @@
|
||||||
(fn [changes parent]
|
(fn [changes parent]
|
||||||
(let [children (->> parent :shapes (map (d/getf objects)))
|
(let [children (->> parent :shapes (map (d/getf objects)))
|
||||||
resized-parent (cond
|
resized-parent (cond
|
||||||
(empty? children)
|
(empty? children) ;; a parent with no children will be deleted,
|
||||||
changes
|
nil ;; so it does not need resize
|
||||||
|
|
||||||
(= (:type parent) :bool)
|
(= (:type parent) :bool)
|
||||||
(gshb/update-bool-selrect parent children objects)
|
(gshb/update-bool-selrect parent children objects)
|
||||||
|
@ -419,21 +419,22 @@
|
||||||
(= (:type parent) :group)
|
(= (:type parent) :group)
|
||||||
(if (:masked-group? parent)
|
(if (:masked-group? parent)
|
||||||
(gsh/update-mask-selrect parent children)
|
(gsh/update-mask-selrect parent children)
|
||||||
(gsh/update-group-selrect parent children)))
|
(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))
|
||||||
|
|
||||||
{rops :rops uops :uops}
|
change {:type :mod-obj
|
||||||
(reduce #(generate-operation %1 %2 parent resized-parent)
|
:page-id page-id
|
||||||
{:rops [] :uops []}
|
:id (:id parent)}]
|
||||||
(keys parent))
|
|
||||||
|
|
||||||
change {:type :mod-obj
|
(if (seq rops)
|
||||||
:page-id page-id
|
(-> changes
|
||||||
:id (:id parent)}]
|
(update :redo-changes conj (assoc change :operations rops))
|
||||||
|
(update :undo-changes d/preconj (assoc change :operations uops)))
|
||||||
(if (seq rops)
|
changes))
|
||||||
(-> 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)
|
(-> (reduce resize-parent changes all-parents)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue