0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-04-16 00:41:25 -05:00

Properly use take-until on shape movement streams.

This commit is contained in:
Andrey Antukh 2021-12-22 17:06:16 +01:00
parent d06cfed50e
commit c2f604cd01

View file

@ -502,7 +502,6 @@
stopper (rx/filter ms/mouse-up? stream)]
(when-not (empty? selected)
(->> ms/mouse-position
(rx/take-until stopper)
(rx/map #(gpt/to-vec initial %))
(rx/map #(gpt/length %))
(rx/filter #(> % 1))
@ -515,7 +514,9 @@
(rx/of (start-move-duplicate initial)
(dws/duplicate-selected false))
;; Otherwise just plain old move
(rx/of (start-move initial selected)))))))))))
(rx/of (start-move initial selected)))))
(rx/take-until stopper)))))))
(defn- start-move-duplicate
[from-position]
@ -556,7 +557,6 @@
delta)))
position (->> ms/mouse-position
(rx/take-until stopper)
(rx/with-latest-from ms/mouse-position-shift)
(rx/map #(fix-axis %)))
@ -575,7 +575,8 @@
(->> position
(rx/with-latest vector snap-delta)
(rx/map snap/correct-snap-point)
(rx/map set-local-displacement))
(rx/map set-local-displacement)
(rx/take-until stopper))
(rx/of (set-modifiers ids)
(apply-modifiers ids)