mirror of
https://github.com/penpot/penpot.git
synced 2025-01-11 01:10:28 -05:00
✨ Improved canvas displacement on options.
This commit is contained in:
parent
35e50dc47c
commit
8f77a59a97
1 changed files with 9 additions and 4 deletions
|
@ -36,10 +36,15 @@
|
|||
|
||||
on-position-change
|
||||
(fn [event attr]
|
||||
(let [value (-> (dom/get-target event)
|
||||
(dom/get-value)
|
||||
(d/parse-integer))]
|
||||
(st/emit! (udw/update-position (:id shape) {attr value}))))
|
||||
(let [cval (-> (dom/get-target event)
|
||||
(dom/get-value)
|
||||
(d/parse-integer))
|
||||
pval (get shape attr)
|
||||
delta (if (= attr :x)
|
||||
(gpt/point (math/neg (- pval cval)) 0)
|
||||
(gpt/point 0 (math/neg (- pval cval))))]
|
||||
(st/emit! (udw/apply-canvas-displacement (:id shape) delta)
|
||||
(udw/materialize-canvas-displacement (:id shape)))))
|
||||
|
||||
on-width-change #(on-size-change % :width)
|
||||
on-height-change #(on-size-change % :height)
|
||||
|
|
Loading…
Reference in a new issue