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:
parent
c70bb876b2
commit
c7a46c31b4
1 changed files with 11 additions and 8 deletions
|
@ -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 ----------------------------------------------------------------------
|
||||
|
||||
|
|
Loading…
Reference in a new issue