0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-21 06:02:32 -05:00

Add ability to apply rotation token

This commit is contained in:
Akshay Gupta 2024-05-22 13:08:59 +05:30
parent e874ed5b6c
commit 3793f1791a
2 changed files with 13 additions and 0 deletions

View file

@ -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"}])

View file

@ -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}]}}]