mirror of
https://github.com/penpot/penpot.git
synced 2025-02-01 20:09:04 -05:00
Add simple token spacing application
This commit is contained in:
parent
68a201374c
commit
76a38bcb0c
2 changed files with 13 additions and 1 deletions
|
@ -89,6 +89,8 @@
|
||||||
[:position-x {:optional true} ::sm/uuid]
|
[:position-x {:optional true} ::sm/uuid]
|
||||||
[:position-y {:optional true} ::sm/uuid]])
|
[:position-y {:optional true} ::sm/uuid]])
|
||||||
|
|
||||||
|
(def spacing-keys (schema-keys ::spacing))
|
||||||
|
|
||||||
(sm/def! ::tokens
|
(sm/def! ::tokens
|
||||||
[:map {:title "Applied Tokens"}])
|
[:map {:title "Applied Tokens"}])
|
||||||
|
|
||||||
|
|
|
@ -10,8 +10,11 @@
|
||||||
[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.workspace.changes :as dch]
|
[app.main.data.workspace.changes :as dch]
|
||||||
|
[app.main.data.workspace.shape-layout :as dwsl]
|
||||||
|
[app.main.data.workspace.state-helpers :as wsh]
|
||||||
[app.main.data.workspace.transforms :as dwt]
|
[app.main.data.workspace.transforms :as dwt]
|
||||||
[app.main.store :as st]))
|
[app.main.store :as st]
|
||||||
|
[beicon.v2.core :as rx]))
|
||||||
|
|
||||||
;; Helpers ---------------------------------------------------------------------
|
;; Helpers ---------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -45,6 +48,11 @@
|
||||||
(dwt/update-dimensions shape-ids :width value)
|
(dwt/update-dimensions shape-ids :width value)
|
||||||
(dwt/update-dimensions shape-ids :height value)))
|
(dwt/update-dimensions shape-ids :height 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}}))))
|
||||||
|
|
||||||
;; Token types -----------------------------------------------------------------
|
;; Token types -----------------------------------------------------------------
|
||||||
|
|
||||||
(def token-types
|
(def token-types
|
||||||
|
@ -100,6 +108,8 @@
|
||||||
:key :rotation}]}}]
|
:key :rotation}]}}]
|
||||||
[:spacing
|
[:spacing
|
||||||
{:title "Spacing"
|
{:title "Spacing"
|
||||||
|
:attributes ctt/spacing-keys
|
||||||
|
:on-update-shape update-layout-spacing-column
|
||||||
:modal {:key :tokens/spacing
|
:modal {:key :tokens/spacing
|
||||||
:fields [{:label "Spacing"
|
:fields [{:label "Spacing"
|
||||||
:key :spacing}]}}]
|
:key :spacing}]}}]
|
||||||
|
|
Loading…
Add table
Reference in a new issue