From 9b13444c44e41e72a67bed3e1d9ebe47f924248d Mon Sep 17 00:00:00 2001 From: Akshay Gupta Date: Mon, 20 May 2024 21:59:28 +0530 Subject: [PATCH] spacing token to update only row or column gap as per flex direction --- frontend/src/app/main/ui/workspace/tokens/core.cljs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/frontend/src/app/main/ui/workspace/tokens/core.cljs b/frontend/src/app/main/ui/workspace/tokens/core.cljs index 20eebea40..f6b95dfa3 100644 --- a/frontend/src/app/main/ui/workspace/tokens/core.cljs +++ b/frontend/src/app/main/ui/workspace/tokens/core.cljs @@ -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 -----------------------------------------------------------------