0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-06 14:50:20 -05:00

Convert layout spacing to function

This commit is contained in:
Florian Schroedl 2024-07-05 08:53:45 +02:00
parent c70bb876b2
commit c7a46c31b4

View file

@ -85,14 +85,17 @@
(udw/increase-rotation shape-ids value)))))
(defn update-layout-spacing-column [value shape-ids]
(doseq [shape-id shape-ids]
(let [shape (dt/get-shape-from-state shape-id @st/state)
layout-direction (:layout-flex-dir shape)
layout-update (if (or (= layout-direction :row-reverse) (= layout-direction :row))
{:layout-gap {:column-gap value}}
{:layout-gap {:row-gap value}})]
(st/emit!
(dwsl/update-layout [shape-id] layout-update)))))
(ptk/reify ::update-layout-spacing-column
ptk/WatchEvent
(watch [_ state _]
(rx/concat
(for [shape-id shape-ids]
(let [shape (dt/get-shape-from-state shape-id state)
layout-direction (:layout-flex-dir shape)
layout-update (if (or (= layout-direction :row-reverse) (= layout-direction :row))
{:layout-gap {:column-gap value}}
{:layout-gap {:row-gap value}})]
(dwsl/update-layout [shape-id] layout-update)))))))
;; Events ----------------------------------------------------------------------