mirror of
https://github.com/penpot/penpot.git
synced 2025-02-01 11:59:17 -05:00
Add ability to apply rotation token
This commit is contained in:
parent
e874ed5b6c
commit
3793f1791a
2 changed files with 13 additions and 0 deletions
|
@ -112,6 +112,12 @@
|
||||||
|
|
||||||
(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"}])
|
||||||
|
|
||||||
|
|
|
@ -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