mirror of
https://github.com/penpot/penpot.git
synced 2026-08-06 21:08:34 +00:00
💄 Add cosmetic improvements to align-objects event
This commit is contained in:
parent
9b477ca0eb
commit
ea47ce30df
@ -1004,20 +1004,18 @@
|
|||||||
(ptk/reify ::align-objects
|
(ptk/reify ::align-objects
|
||||||
ptk/WatchEvent
|
ptk/WatchEvent
|
||||||
(watch [_ state _]
|
(watch [_ state _]
|
||||||
(let [page-id (:current-page-id state)
|
(let [objects (wsh/lookup-page-objects state)
|
||||||
objects (wsh/lookup-page-objects state page-id)
|
|
||||||
selected (wsh/lookup-selected state)
|
selected (wsh/lookup-selected state)
|
||||||
moved (if (= 1 (count selected))
|
moved (if (= 1 (count selected))
|
||||||
(align-object-to-parent objects (first selected) axis)
|
(align-object-to-parent objects (first selected) axis)
|
||||||
(align-objects-list objects selected axis))
|
(align-objects-list objects selected axis))
|
||||||
ids (map :id moved)
|
|
||||||
undo-id (js/Symbol)]
|
undo-id (js/Symbol)]
|
||||||
(when (can-align? selected objects)
|
(when (can-align? selected objects)
|
||||||
(rx/concat
|
(rx/concat
|
||||||
(rx/of (dwu/start-undo-transaction undo-id))
|
(rx/of (dwu/start-undo-transaction undo-id))
|
||||||
(->> (rx/from moved)
|
(->> (rx/from moved)
|
||||||
(rx/map move-shape))
|
(rx/map move-shape))
|
||||||
(rx/of (ptk/data-event :layout/update ids)
|
(rx/of (ptk/data-event :layout/update (mapv :id moved))
|
||||||
(dwu/commit-undo-transaction undo-id))))))))
|
(dwu/commit-undo-transaction undo-id))))))))
|
||||||
|
|
||||||
(defn align-object-to-parent
|
(defn align-object-to-parent
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user