mirror of
https://github.com/penpot/penpot.git
synced 2025-01-24 15:39:50 -05:00
✨ Properly emit changes on rect dimensions are touched.
This commit is contained in:
parent
55c2ad9644
commit
655c7ae023
2 changed files with 13 additions and 7 deletions
|
@ -1095,8 +1095,6 @@
|
|||
(s/def ::update-dimensions
|
||||
(s/keys :opt-un [::width ::height]))
|
||||
|
||||
;; TODO: emit commit-changes
|
||||
|
||||
(defn update-dimensions
|
||||
"A helper event just for update the position
|
||||
of the shape using the width and height attrs
|
||||
|
@ -1105,9 +1103,19 @@
|
|||
(us/assert ::us/uuid id)
|
||||
(us/assert ::update-dimensions dimensions)
|
||||
(ptk/reify ::update-dimensions
|
||||
IBatchedChange
|
||||
ptk/UpdateEvent
|
||||
(update [_ state]
|
||||
(update-in state [:workspace-data :shapes-by-id id] geom/resize-dim dimensions))))
|
||||
(let [shape-old (get-in state [:workspace-data :shapes-by-id id])
|
||||
shape-new (geom/resize-dim shape-old dimensions)
|
||||
operations (d/diff-maps shape-old shape-new)
|
||||
change {:type :mod-shape
|
||||
:session-id (:session-id state)
|
||||
:operations operations
|
||||
:id id}]
|
||||
(-> state
|
||||
(assoc-in [:workspace-data :shapes-by-id id] shape-new)
|
||||
(update ::batched-changes (fnil conj []) change))))))
|
||||
|
||||
;; --- Shape Proportions
|
||||
|
||||
|
|
|
@ -201,10 +201,8 @@
|
|||
instead of absolute positions."
|
||||
[shape opts]
|
||||
(case (:type shape)
|
||||
:rect (resize-dim-rect shape opts)
|
||||
:icon (resize-dim-rect shape opts)
|
||||
:image (resize-dim-rect shape opts)
|
||||
:circle (resize-dim-circle shape opts)))
|
||||
:cirle (resize-dim-circle shape opts)
|
||||
(resize-dim-rect shape opts)))
|
||||
|
||||
(defn- resize-dim-rect
|
||||
[{:keys [proportion proportion-lock x y] :as shape}
|
||||
|
|
Loading…
Add table
Reference in a new issue