mirror of
https://github.com/penpot/penpot.git
synced 2025-01-21 14:12:36 -05:00
Merge pull request #126 from tokens-studio/rotation-token
Add ability to apply rotation token
This commit is contained in:
commit
44f55308a6
2 changed files with 16 additions and 1 deletions
|
@ -112,12 +112,20 @@
|
||||||
|
|
||||||
(def dimensions-keys (schema-keys ::dimensions))
|
(def dimensions-keys (schema-keys ::dimensions))
|
||||||
|
|
||||||
|
(sm/def! ::rotation
|
||||||
|
[:map
|
||||||
|
[:rotation ::sm/uuid]])
|
||||||
|
|
||||||
|
(def rotation-keys (schema-keys ::rotation))
|
||||||
|
|
||||||
(sm/def! ::tokens
|
(sm/def! ::tokens
|
||||||
[:map {:title "Applied Tokens"}])
|
[:map {:title "Applied Tokens"
|
||||||
|
:closed true}])
|
||||||
|
|
||||||
(sm/def! ::applied-tokens
|
(sm/def! ::applied-tokens
|
||||||
(merge-schemas ::tokens
|
(merge-schemas ::tokens
|
||||||
::border-radius
|
::border-radius
|
||||||
::sizing
|
::sizing
|
||||||
::spacing
|
::spacing
|
||||||
|
::rotation
|
||||||
::dimensions))
|
::dimensions))
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
[app.common.types.shape.radius :as ctsr]
|
[app.common.types.shape.radius :as ctsr]
|
||||||
[app.common.types.token :as ctt]
|
[app.common.types.token :as ctt]
|
||||||
[app.main.data.tokens :as dt]
|
[app.main.data.tokens :as dt]
|
||||||
|
[app.main.data.workspace :as udw]
|
||||||
[app.main.data.workspace.changes :as dch]
|
[app.main.data.workspace.changes :as dch]
|
||||||
[app.main.data.workspace.shape-layout :as dwsl]
|
[app.main.data.workspace.shape-layout :as dwsl]
|
||||||
[app.main.data.workspace.state-helpers :as wsh]
|
[app.main.data.workspace.state-helpers :as wsh]
|
||||||
|
@ -101,6 +102,10 @@
|
||||||
(when (seq (:strokes shape))
|
(when (seq (:strokes shape))
|
||||||
(assoc-in shape [:strokes 0 :stroke-width] value))))))
|
(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]
|
(defn update-layout-spacing-column [value shape-ids]
|
||||||
(doseq [shape-id shape-ids]
|
(doseq [shape-id shape-ids]
|
||||||
(let [shape (dt/get-shape-from-state shape-id @st/state)
|
(let [shape (dt/get-shape-from-state shape-id @st/state)
|
||||||
|
@ -172,6 +177,8 @@
|
||||||
:key :other}]}}]
|
:key :other}]}}]
|
||||||
[:rotation
|
[:rotation
|
||||||
{:title "Rotation"
|
{:title "Rotation"
|
||||||
|
:attributes ctt/rotation-keys
|
||||||
|
:on-update-shape update-rotation
|
||||||
:modal {:key :tokens/rotation
|
:modal {:key :tokens/rotation
|
||||||
:fields [{:label "Rotation"
|
:fields [{:label "Rotation"
|
||||||
:key :rotation}]}}]
|
:key :rotation}]}}]
|
||||||
|
|
Loading…
Add table
Reference in a new issue