mirror of
https://github.com/penpot/penpot.git
synced 2025-01-08 07:50:43 -05:00
Use single undo operation for width/height change
This commit is contained in:
parent
96a7cf2e98
commit
464bdf3d9c
1 changed files with 5 additions and 2 deletions
|
@ -237,15 +237,18 @@
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
(mf/deps ids)
|
(mf/deps ids)
|
||||||
(fn [value attr]
|
(fn [value attr]
|
||||||
(let [token-value (wtc/maybe-resolve-token-value value)]
|
(let [token-value (wtc/maybe-resolve-token-value value)
|
||||||
|
undo-id (js/Symbol)]
|
||||||
(st/emit! (udw/trigger-bounding-box-cloaking ids)
|
(st/emit! (udw/trigger-bounding-box-cloaking ids)
|
||||||
|
(dwu/start-undo-transaction undo-id)
|
||||||
(dch/update-shapes ids
|
(dch/update-shapes ids
|
||||||
(if token-value
|
(if token-value
|
||||||
#(assoc-in % [:applied-tokens attr] (:id value))
|
#(assoc-in % [:applied-tokens attr] (:id value))
|
||||||
#(d/dissoc-in % [:applied-tokens attr]))
|
#(d/dissoc-in % [:applied-tokens attr]))
|
||||||
{:reg-objects? true
|
{:reg-objects? true
|
||||||
:attrs [:applied-tokens]})
|
:attrs [:applied-tokens]})
|
||||||
(udw/update-dimensions ids attr (or token-value value))))))
|
(udw/update-dimensions ids attr (or token-value value))
|
||||||
|
(dwu/commit-undo-transaction undo-id)))))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue