0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-24 07:29:08 -05:00

Setup new shape proportions on the end of resize.

This commit is contained in:
Andrey Antukh 2016-09-29 07:12:07 +02:00
parent 5d0661c05f
commit a11b618d24
No known key found for this signature in database
GPG key ID: 4DFEBCB8316A8B95

View file

@ -44,11 +44,12 @@
;; --- Resize Implementation
(defn- start-resize
[vid shape]
[vid sid]
(letfn [(on-resize [[delta ctrl?]]
(let [params {:vid vid :delta (assoc delta :lock ctrl?)}]
(rs/emit! (uds/update-vertex-position shape params))))
(rs/emit! (uds/update-vertex-position sid params))))
(on-end []
(rs/emit! (uds/setup-proportions sid))
(rlocks/release! :shape/resize))]
(let [stoper (->> wb/events-s
(rx/map first)
@ -59,7 +60,7 @@
(rx/with-latest-from vector wb/mouse-ctrl-s))]
(rlocks/acquire! :shape/resize)
(when @wb/alignment-ref
(rs/emit! (uds/initial-vertext-align shape vid)))
(rs/emit! (uds/initial-vertext-align sid vid)))
(rx/subscribe stream on-resize nil on-end))))
;; --- Selection Handlers (Component)