mirror of
https://github.com/penpot/penpot.git
synced 2025-05-24 21:46:12 +02:00
✨ Properly use take-until on shape movement streams.
This commit is contained in:
parent
d06cfed50e
commit
c2f604cd01
1 changed files with 5 additions and 4 deletions
|
@ -502,7 +502,6 @@
|
||||||
stopper (rx/filter ms/mouse-up? stream)]
|
stopper (rx/filter ms/mouse-up? stream)]
|
||||||
(when-not (empty? selected)
|
(when-not (empty? selected)
|
||||||
(->> ms/mouse-position
|
(->> ms/mouse-position
|
||||||
(rx/take-until stopper)
|
|
||||||
(rx/map #(gpt/to-vec initial %))
|
(rx/map #(gpt/to-vec initial %))
|
||||||
(rx/map #(gpt/length %))
|
(rx/map #(gpt/length %))
|
||||||
(rx/filter #(> % 1))
|
(rx/filter #(> % 1))
|
||||||
|
@ -515,7 +514,9 @@
|
||||||
(rx/of (start-move-duplicate initial)
|
(rx/of (start-move-duplicate initial)
|
||||||
(dws/duplicate-selected false))
|
(dws/duplicate-selected false))
|
||||||
;; Otherwise just plain old move
|
;; 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
|
(defn- start-move-duplicate
|
||||||
[from-position]
|
[from-position]
|
||||||
|
@ -556,7 +557,6 @@
|
||||||
delta)))
|
delta)))
|
||||||
|
|
||||||
position (->> ms/mouse-position
|
position (->> ms/mouse-position
|
||||||
(rx/take-until stopper)
|
|
||||||
(rx/with-latest-from ms/mouse-position-shift)
|
(rx/with-latest-from ms/mouse-position-shift)
|
||||||
(rx/map #(fix-axis %)))
|
(rx/map #(fix-axis %)))
|
||||||
|
|
||||||
|
@ -575,7 +575,8 @@
|
||||||
(->> position
|
(->> position
|
||||||
(rx/with-latest vector snap-delta)
|
(rx/with-latest vector snap-delta)
|
||||||
(rx/map snap/correct-snap-point)
|
(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)
|
(rx/of (set-modifiers ids)
|
||||||
(apply-modifiers ids)
|
(apply-modifiers ids)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue