mirror of
https://github.com/penpot/penpot.git
synced 2025-02-03 21:09:00 -05:00
Remove unused mouse-events- and keyboard-events- streams.
This commit is contained in:
parent
12a74070d2
commit
92a0ffc1ae
3 changed files with 16 additions and 23 deletions
|
@ -16,7 +16,10 @@
|
|||
[goog.events :as events])
|
||||
(:import goog.events.EventType))
|
||||
|
||||
;; --- Lenses
|
||||
;; FIXME: split this namespace in two:
|
||||
;; uxbox.main.ui.streams and uxbox.main.ui.workspace.refs
|
||||
|
||||
;; --- Refs
|
||||
|
||||
(def workspace-ref
|
||||
(-> (l/in [:workspace])
|
||||
|
@ -80,19 +83,9 @@
|
|||
|
||||
;; --- Events
|
||||
|
||||
;; TODO: this should replace mouse-events-s and keyboard-events-b
|
||||
(defonce events-b (rx/bus))
|
||||
(defonce events-s (rx/dedupe events-b))
|
||||
|
||||
(defonce mouse-events-b (rx/bus))
|
||||
(defonce mouse-events-s (rx/dedupe mouse-events-b))
|
||||
|
||||
;; (defonce kaka
|
||||
;; (rx/subscribe mouse-events-s #(println "event:" %)))
|
||||
|
||||
(defonce keyboard-events-b (rx/bus))
|
||||
(defonce keyboard-events-s (rx/dedupe keyboard-events-b))
|
||||
|
||||
;; --- Mouse Position Stream
|
||||
|
||||
(defonce mouse-b (rx/bus))
|
||||
|
|
|
@ -83,18 +83,18 @@
|
|||
(gpt/subtract brect))))))
|
||||
|
||||
(on-key-down [event]
|
||||
(rx/push! wb/keyboard-events-b {:type :keyboard/down
|
||||
:key (.-keyCode event)
|
||||
:shift? (kbd/shift? event)
|
||||
:ctrl? (kbd/ctrl? event)})
|
||||
(when (kbd/space? event)
|
||||
(rlocks/acquire! :workspace/scroll)))
|
||||
(let [opts {:key (.-keyCode event)
|
||||
:shift? (kbd/shift? event)
|
||||
:ctrl? (kbd/ctrl? event)}]
|
||||
(rx/push! wb/events-b [:keyboard/down opts])
|
||||
(when (kbd/space? event)
|
||||
(rlocks/acquire! :workspace/scroll))))
|
||||
|
||||
(on-key-up [event]
|
||||
(rx/push! wb/keyboard-events-b {:type :keyboard/up
|
||||
:key (.-keyCode event)
|
||||
:shift? (kbd/shift? event)
|
||||
:ctrl? (kbd/ctrl? event)}))
|
||||
(let [opts {:key (.-keyCode event)
|
||||
:shift? (kbd/shift? event)
|
||||
:ctrl? (kbd/ctrl? event)}]
|
||||
(rx/push! wb/events-b [:keyboard/up opts])))
|
||||
|
||||
(on-mousemove [event]
|
||||
(let [wpt (gpt/point (.-clientX event)
|
||||
|
|
|
@ -15,11 +15,11 @@
|
|||
|
||||
(defn watch-scroll-interactions
|
||||
[own]
|
||||
(letfn [(is-space-up? [{:keys [key type]}]
|
||||
(letfn [(is-space-up? [[type {:keys [key]}]]
|
||||
(and (= 32 key) (= :keyboard/up type)))
|
||||
|
||||
(on-start []
|
||||
(let [stoper (->> wb/keyboard-events-s
|
||||
(let [stoper (->> wb/events-s
|
||||
(rx/filter is-space-up?)
|
||||
(rx/take 1))
|
||||
local (:rum/local own)
|
||||
|
|
Loading…
Add table
Reference in a new issue