mirror of
https://github.com/penpot/penpot.git
synced 2025-08-06 13:38:30 +02:00
⚡ Add performance oriented refactor for mouse streams
This commit is contained in:
parent
b6ef21e121
commit
82dc1526d4
18 changed files with 237 additions and 136 deletions
|
@ -35,12 +35,15 @@
|
|||
[app.main.refs :as refs]
|
||||
[app.main.streams :as ms]
|
||||
[app.main.worker :as uw]
|
||||
[app.util.mouse :as mse]
|
||||
[beicon.core :as rx]
|
||||
[clojure.set :as set]
|
||||
[linked.set :as lks]
|
||||
[potok.core :as ptk]))
|
||||
|
||||
(defn interrupt? [e] (= e :interrupt))
|
||||
(defn interrupt?
|
||||
[e]
|
||||
(= e :interrupt))
|
||||
|
||||
;; --- Selection Rect
|
||||
|
||||
|
@ -60,8 +63,12 @@
|
|||
ptk/WatchEvent
|
||||
(watch [_ state stream]
|
||||
(let [zoom (dm/get-in state [:workspace-local :zoom] 1)
|
||||
stop? (fn [event] (or (interrupt? event) (ms/mouse-up? event)))
|
||||
stoper (rx/filter stop? stream)
|
||||
stoper (rx/merge
|
||||
(->> stream
|
||||
(rx/filter mse/mouse-event?)
|
||||
(rx/filter mse/mouse-up-event?))
|
||||
(->> stream
|
||||
(rx/filter interrupt?)))
|
||||
|
||||
init-position @ms/mouse-position
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue