0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-08 07:50:43 -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] [:min-width {:optional true} ::sm/uuid]
[:max-width {:optional true} ::sm/uuid]]) [:max-width {:optional true} ::sm/uuid]])
(def dimensions-keys (schema-keys ::dimensions))
(sm/def! ::spacing (sm/def! ::spacing
[:map [:map
[:spacing-column {:optional true} ::sm/uuid] [:spacing-column {:optional true} ::sm/uuid]

View file

@ -9,7 +9,9 @@
[app.common.data :as d :refer [ordered-map]] [app.common.data :as d :refer [ordered-map]]
[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.transforms :as dwt]
[app.main.store :as st]))
;; Helpers --------------------------------------------------------------------- ;; Helpers ---------------------------------------------------------------------
@ -38,6 +40,11 @@
{:reg-objects? true {:reg-objects? true
:attrs ctt/border-radius-keys}))) :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 ----------------------------------------------------------------- ;; Token types -----------------------------------------------------------------
(def token-types (def token-types
@ -65,7 +72,9 @@
:fields [{:label "Sizing" :fields [{:label "Sizing"
:key :sizing}]}}] :key :sizing}]}}]
[:dimension [:dimension
{:title "Dimension" {:title "Dimensions"
:attributes ctt/dimensions-keys
:on-update-shape update-shape-dimensions
:modal {:key :tokens/dimensions :modal {:key :tokens/dimensions
:fields [{:label "Dimensions" :fields [{:label "Dimensions"
:key :dimensions}]}}] :key :dimensions}]}}]