mirror of
https://github.com/penpot/penpot.git
synced 2025-02-10 00:58:26 -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])
|
[goog.events :as events])
|
||||||
(:import goog.events.EventType))
|
(: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
|
(def workspace-ref
|
||||||
(-> (l/in [:workspace])
|
(-> (l/in [:workspace])
|
||||||
|
@ -80,19 +83,9 @@
|
||||||
|
|
||||||
;; --- Events
|
;; --- Events
|
||||||
|
|
||||||
;; TODO: this should replace mouse-events-s and keyboard-events-b
|
|
||||||
(defonce events-b (rx/bus))
|
(defonce events-b (rx/bus))
|
||||||
(defonce events-s (rx/dedupe events-b))
|
(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
|
;; --- Mouse Position Stream
|
||||||
|
|
||||||
(defonce mouse-b (rx/bus))
|
(defonce mouse-b (rx/bus))
|
||||||
|
|
|
@ -83,18 +83,18 @@
|
||||||
(gpt/subtract brect))))))
|
(gpt/subtract brect))))))
|
||||||
|
|
||||||
(on-key-down [event]
|
(on-key-down [event]
|
||||||
(rx/push! wb/keyboard-events-b {:type :keyboard/down
|
(let [opts {:key (.-keyCode event)
|
||||||
:key (.-keyCode event)
|
|
||||||
:shift? (kbd/shift? event)
|
:shift? (kbd/shift? event)
|
||||||
:ctrl? (kbd/ctrl? event)})
|
:ctrl? (kbd/ctrl? event)}]
|
||||||
|
(rx/push! wb/events-b [:keyboard/down opts])
|
||||||
(when (kbd/space? event)
|
(when (kbd/space? event)
|
||||||
(rlocks/acquire! :workspace/scroll)))
|
(rlocks/acquire! :workspace/scroll))))
|
||||||
|
|
||||||
(on-key-up [event]
|
(on-key-up [event]
|
||||||
(rx/push! wb/keyboard-events-b {:type :keyboard/up
|
(let [opts {:key (.-keyCode event)
|
||||||
:key (.-keyCode event)
|
|
||||||
:shift? (kbd/shift? event)
|
:shift? (kbd/shift? event)
|
||||||
:ctrl? (kbd/ctrl? event)}))
|
:ctrl? (kbd/ctrl? event)}]
|
||||||
|
(rx/push! wb/events-b [:keyboard/up opts])))
|
||||||
|
|
||||||
(on-mousemove [event]
|
(on-mousemove [event]
|
||||||
(let [wpt (gpt/point (.-clientX event)
|
(let [wpt (gpt/point (.-clientX event)
|
||||||
|
|
|
@ -15,11 +15,11 @@
|
||||||
|
|
||||||
(defn watch-scroll-interactions
|
(defn watch-scroll-interactions
|
||||||
[own]
|
[own]
|
||||||
(letfn [(is-space-up? [{:keys [key type]}]
|
(letfn [(is-space-up? [[type {:keys [key]}]]
|
||||||
(and (= 32 key) (= :keyboard/up type)))
|
(and (= 32 key) (= :keyboard/up type)))
|
||||||
|
|
||||||
(on-start []
|
(on-start []
|
||||||
(let [stoper (->> wb/keyboard-events-s
|
(let [stoper (->> wb/events-s
|
||||||
(rx/filter is-space-up?)
|
(rx/filter is-space-up?)
|
||||||
(rx/take 1))
|
(rx/take 1))
|
||||||
local (:rum/local own)
|
local (:rum/local own)
|
||||||
|
|
Loading…
Add table
Reference in a new issue