mirror of
https://github.com/penpot/penpot.git
synced 2025-01-23 06:58:58 -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)))))
|
(udw/increase-rotation shape-ids value)))))
|
||||||
|
|
||||||
(defn update-layout-spacing-column [value shape-ids]
|
(defn update-layout-spacing-column [value shape-ids]
|
||||||
(doseq [shape-id shape-ids]
|
(ptk/reify ::update-layout-spacing-column
|
||||||
(let [shape (dt/get-shape-from-state shape-id @st/state)
|
ptk/WatchEvent
|
||||||
layout-direction (:layout-flex-dir shape)
|
(watch [_ state _]
|
||||||
layout-update (if (or (= layout-direction :row-reverse) (= layout-direction :row))
|
(rx/concat
|
||||||
{:layout-gap {:column-gap value}}
|
(for [shape-id shape-ids]
|
||||||
{:layout-gap {:row-gap value}})]
|
(let [shape (dt/get-shape-from-state shape-id state)
|
||||||
(st/emit!
|
layout-direction (:layout-flex-dir shape)
|
||||||
(dwsl/update-layout [shape-id] layout-update)))))
|
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 ----------------------------------------------------------------------
|
;; Events ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue