0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-21 14:12:36 -05:00

Update width value

This commit is contained in:
Florian Schroedl 2024-05-24 08:55:04 +02:00
parent 595831118d
commit bc620ba2cd

View file

@ -229,12 +229,18 @@
(mf/use-fn (mf/use-fn
(mf/deps ids) (mf/deps ids)
(fn [value attr] (fn [value attr]
(st/emit! (udw/trigger-bounding-box-cloaking ids) (let [token-value (wtc/maybe-resolve-token-value value)]
(dch/update-shapes ids (js/console.log "token-value" token-value value)
#(assoc % :applied-tokens {}) (st/emit! (udw/trigger-bounding-box-cloaking ids)
{:reg-objects? true (dch/update-shapes ids
:attrs [:applied-tokens]}) (if token-value
(udw/update-dimensions ids attr value)))) #(assoc-in % [:applied-tokens attr] (:id value))
#(dissoc % :applied-tokens attr))
{:reg-objects? true
:attrs [:applied-tokens]})
(udw/update-dimensions ids attr (or token-value value))))))
on-proportion-lock-change on-proportion-lock-change
(mf/use-fn (mf/use-fn
@ -435,13 +441,19 @@
:disabled disabled-width-sizing?) :disabled disabled-width-sizing?)
:title (tr "workspace.options.width")} :title (tr "workspace.options.width")}
[:span {:class (stl/css :icon-text)} "W"] [:span {:class (stl/css :icon-text)} "W"]
[:> numeric-input* {:min 0.01 [:& editable-select
:no-validate true {:min 0.01
:placeholder (if (= :multiple (:width values)) (tr "settings.multiple") "--") :class (stl/css :token-select)
:on-change on-width-change :disabled disabled-width-sizing?
:disabled disabled-width-sizing? :input-class (stl/css :numeric-input)
:className (stl/css :numeric-input) :no-validate true
:value (:width values)}]] :on-change on-width-change
:on-token-remove #(on-width-change (wtc/maybe-resolve-token-value %))
:options sizing-options
:placeholder (if (= :multiple (:rx values)) (tr "settings.multiple") "--")
:position :left
:type "number"
:value (:width values)}]]
[:div {:class (stl/css-case :height true [:div {:class (stl/css-case :height true
:disabled disabled-height-sizing?) :disabled disabled-height-sizing?)
:title (tr "workspace.options.height")} :title (tr "workspace.options.height")}