mirror of
https://github.com/penpot/penpot.git
synced 2025-02-10 17:18:21 -05:00
Remove empty groups.
This commit is contained in:
parent
07359752ff
commit
deb38435fd
1 changed files with 13 additions and 1 deletions
|
@ -157,6 +157,17 @@
|
|||
(into [] (remove #(= % id) $))
|
||||
(assoc-in state [:pages-by-id page :shapes] $)))
|
||||
|
||||
(clear-empty-groups [state {:keys [group] :as :shape}]
|
||||
(if-let [group' (get-in state [:shapes-by-id group])]
|
||||
(if (empty? (:items group'))
|
||||
(as-> state $
|
||||
(dissoc-from-page $ group')
|
||||
(dissoc-from-group $ group')
|
||||
(dissoc-from-index $ group')
|
||||
(clear-empty-groups $ group'))
|
||||
state)
|
||||
state))
|
||||
|
||||
(dissoc-from-index [state shape]
|
||||
(case (:type shape)
|
||||
:builtin/rect (dissoc-icon state shape)
|
||||
|
@ -171,7 +182,8 @@
|
|||
(as-> state $
|
||||
(dissoc-from-page $ shape)
|
||||
(dissoc-from-group $ shape)
|
||||
(dissoc-from-index $ shape)))))))
|
||||
(dissoc-from-index $ shape)
|
||||
(clear-empty-groups $ shape)))))))
|
||||
|
||||
(defn move-shape
|
||||
"Mark a shape selected for drawing in the canvas."
|
||||
|
|
Loading…
Add table
Reference in a new issue