From 3793f1791a8ca9471e0255bac49337bdf2e5df02 Mon Sep 17 00:00:00 2001 From: Akshay Gupta Date: Wed, 22 May 2024 13:08:59 +0530 Subject: [PATCH] Add ability to apply rotation token --- common/src/app/common/types/token.cljc | 6 ++++++ frontend/src/app/main/ui/workspace/tokens/core.cljs | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/common/src/app/common/types/token.cljc b/common/src/app/common/types/token.cljc index 9b6cd5201..e18e1a761 100644 --- a/common/src/app/common/types/token.cljc +++ b/common/src/app/common/types/token.cljc @@ -112,6 +112,12 @@ (def dimensions-keys (schema-keys ::dimensions)) +(sm/def! ::rotation + [:map + [:rotation ::sm/uuid]]) + +(def rotation-keys (schema-keys ::rotation)) + (sm/def! ::tokens [:map {:title "Applied Tokens"}]) diff --git a/frontend/src/app/main/ui/workspace/tokens/core.cljs b/frontend/src/app/main/ui/workspace/tokens/core.cljs index f6b95dfa3..786536893 100644 --- a/frontend/src/app/main/ui/workspace/tokens/core.cljs +++ b/frontend/src/app/main/ui/workspace/tokens/core.cljs @@ -10,6 +10,7 @@ [app.common.types.shape.radius :as ctsr] [app.common.types.token :as ctt] [app.main.data.tokens :as dt] + [app.main.data.workspace :as udw] [app.main.data.workspace.changes :as dch] [app.main.data.workspace.shape-layout :as dwsl] [app.main.data.workspace.state-helpers :as wsh] @@ -101,6 +102,10 @@ (when (seq (:strokes shape)) (assoc-in shape [:strokes 0 :stroke-width] value)))))) +(defn update-rotation [value shape-ids] + (st/emit! (udw/trigger-bounding-box-cloaking shape-ids) + (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) @@ -172,6 +177,8 @@ :key :other}]}}] [:rotation {:title "Rotation" + :attributes ctt/rotation-keys + :on-update-shape update-rotation :modal {:key :tokens/rotation :fields [{:label "Rotation" :key :rotation}]}}]