mirror of
https://github.com/penpot/penpot.git
synced 2025-03-14 16:51:18 -05:00
💄 Add cosmetic changes on ungroup event.
This commit is contained in:
parent
06d41c552b
commit
9ee5a3159c
1 changed files with 17 additions and 11 deletions
|
@ -219,18 +219,24 @@
|
||||||
(ptk/reify ::ungroup-selected
|
(ptk/reify ::ungroup-selected
|
||||||
ptk/WatchEvent
|
ptk/WatchEvent
|
||||||
(watch [it state _]
|
(watch [it state _]
|
||||||
(let [page-id (:current-page-id state)
|
(let [page-id (:current-page-id state)
|
||||||
objects (wsh/lookup-page-objects state page-id)
|
objects (wsh/lookup-page-objects state page-id)
|
||||||
changes-in-bulk (->> (wsh/lookup-selected state)
|
is-group? #(or (= :bool (:type %)) (= :group (:type %)))
|
||||||
(map #(get objects %))
|
lookup #(get objects %)
|
||||||
(filter #(or (= :bool (:type %)) (= :group (:type %))))
|
prepare #(prepare-remove-group page-id % objects)
|
||||||
(map #(prepare-remove-group page-id % objects)))
|
|
||||||
rchanges-in-bulk (into [] (mapcat first) changes-in-bulk)
|
|
||||||
uchanges-in-bulk (into [] (mapcat second) changes-in-bulk)]
|
|
||||||
(rx/of (dch/commit-changes {:redo-changes rchanges-in-bulk
|
|
||||||
:undo-changes uchanges-in-bulk
|
|
||||||
:origin it}))))))
|
|
||||||
|
|
||||||
|
changes (sequence
|
||||||
|
(comp (map lookup)
|
||||||
|
(filter is-group?)
|
||||||
|
(map prepare))
|
||||||
|
(wsh/lookup-selected state))
|
||||||
|
|
||||||
|
rchanges (into [] (mapcat first) changes)
|
||||||
|
uchanges (into [] (mapcat second) changes)]
|
||||||
|
|
||||||
|
(rx/of (dch/commit-changes {:redo-changes rchanges
|
||||||
|
:undo-changes uchanges
|
||||||
|
:origin it}))))))
|
||||||
(def mask-group
|
(def mask-group
|
||||||
(ptk/reify ::mask-group
|
(ptk/reify ::mask-group
|
||||||
ptk/WatchEvent
|
ptk/WatchEvent
|
||||||
|
|
Loading…
Add table
Reference in a new issue