mirror of
https://github.com/penpot/penpot.git
synced 2025-02-25 08:16:49 -05:00
🐛 Fix fast moving drawing and snap interaction
This commit is contained in:
parent
7ddfdb1e15
commit
46b767ab0b
1 changed files with 4 additions and 2 deletions
|
@ -129,6 +129,9 @@
|
||||||
|
|
||||||
(->> ms/mouse-position
|
(->> ms/mouse-position
|
||||||
(rx/filter #(> (gpt/distance % initial) (/ 2 zoom)))
|
(rx/filter #(> (gpt/distance % initial) (/ 2 zoom)))
|
||||||
|
;; Take until before the snap calculation otherwise we could cancel the snap in the worker
|
||||||
|
;; and its a problem for fast moving drawing
|
||||||
|
(rx/take-until stoper)
|
||||||
(rx/with-latest-from ms/mouse-position-shift ms/mouse-position-mod)
|
(rx/with-latest-from ms/mouse-position-shift ms/mouse-position-mod)
|
||||||
(rx/switch-map
|
(rx/switch-map
|
||||||
(fn [[point :as current]]
|
(fn [[point :as current]]
|
||||||
|
@ -136,8 +139,7 @@
|
||||||
(rx/map (partial array/conj current)))))
|
(rx/map (partial array/conj current)))))
|
||||||
(rx/map
|
(rx/map
|
||||||
(fn [[_ shift? mod? point]]
|
(fn [[_ shift? mod? point]]
|
||||||
#(update-drawing % initial (cond-> point snap-pixel? (gpt/round-step snap-prec)) shift? mod?)))))
|
#(update-drawing % initial (cond-> point snap-pixel? (gpt/round-step snap-prec)) shift? mod?))))))
|
||||||
(rx/take-until stoper))
|
|
||||||
|
|
||||||
(->> (rx/of (common/handle-finish-drawing))
|
(->> (rx/of (common/handle-finish-drawing))
|
||||||
(rx/delay 100)))))))
|
(rx/delay 100)))))))
|
||||||
|
|
Loading…
Add table
Reference in a new issue