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

spacing token to update only row or column gap as per flex direction

This commit is contained in:
Akshay Gupta 2024-05-20 21:59:28 +05:30
parent 162e7b6c58
commit 9b13444c44

View file

@ -101,10 +101,15 @@
(when (seq (:strokes shape))
(assoc-in shape [:strokes 0 :stroke-width] value))))))
(defn update-layout-spacing-column [value _shape-ids]
(let [selected-shapes (wsh/lookup-selected @st/state)]
(st/emit!
(dwsl/update-layout selected-shapes {:layout-gap {:column-gap value :row-gap 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)))))
;; Token types -----------------------------------------------------------------