0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-06 14:50:20 -05:00

Add shape dimensions updating

This commit is contained in:
Florian Schroedl 2024-04-25 19:00:00 +02:00
parent a9aac4c867
commit fd39229367
2 changed files with 13 additions and 2 deletions

View file

@ -75,6 +75,8 @@
[:min-width {:optional true} ::sm/uuid]
[:max-width {:optional true} ::sm/uuid]])
(def dimensions-keys (schema-keys ::dimensions))
(sm/def! ::spacing
[:map
[:spacing-column {:optional true} ::sm/uuid]

View file

@ -9,7 +9,9 @@
[app.common.data :as d :refer [ordered-map]]
[app.common.types.shape.radius :as ctsr]
[app.common.types.token :as ctt]
[app.main.data.workspace.changes :as dch]))
[app.main.data.workspace.changes :as dch]
[app.main.data.workspace.transforms :as dwt]
[app.main.store :as st]))
;; Helpers ---------------------------------------------------------------------
@ -38,6 +40,11 @@
{:reg-objects? true
:attrs ctt/border-radius-keys})))
(defn update-shape-dimensions [value shape-ids]
(st/emit!
(dwt/update-dimensions shape-ids :width value)
(dwt/update-dimensions shape-ids :height value)))
;; Token types -----------------------------------------------------------------
(def token-types
@ -65,7 +72,9 @@
:fields [{:label "Sizing"
:key :sizing}]}}]
[:dimension
{:title "Dimension"
{:title "Dimensions"
:attributes ctt/dimensions-keys
:on-update-shape update-shape-dimensions
:modal {:key :tokens/dimensions
:fields [{:label "Dimensions"
:key :dimensions}]}}]