Prevent triggering grub edit on pan
This commit is contained in:
parent
0db764b145
commit
660163c842
3 changed files with 13 additions and 3 deletions
|
@ -22,7 +22,8 @@
|
|||
om/IWillMount
|
||||
(will-mount [_]
|
||||
(let [>events (om/get-shared owner :>events)]
|
||||
(dom/on-document-mousedown #(put! >events {:type :body-mousedown :event %}))))))
|
||||
(dom/on-document-mousedown #(put! >events {:type :body-mousedown :event %}))
|
||||
(dom/on-window-scroll #(put! >events {:type :body-scroll :event %}))))))
|
||||
|
||||
(defn render-app [state]
|
||||
(let [grub-add (chan)
|
||||
|
|
|
@ -13,5 +13,8 @@
|
|||
(defn on-document-mousedown [f]
|
||||
(.addEventListener js/document "mousedown" f))
|
||||
|
||||
(defn on-window-scroll [f]
|
||||
(.addEventListener js/window "scroll" f))
|
||||
|
||||
(defn event-val [event]
|
||||
(.. event -target -value))
|
||||
|
|
|
@ -37,7 +37,8 @@
|
|||
:mouse-out :waiting
|
||||
:touch-cancel :waiting
|
||||
:touch-end :waiting
|
||||
:timeout :editing}
|
||||
:timeout :editing
|
||||
:scroll :waiting}
|
||||
:editing {:enter :waiting
|
||||
:body-mousedown :waiting}})
|
||||
|
||||
|
@ -95,7 +96,12 @@
|
|||
(let [<events (om/get-shared owner :<events)
|
||||
subscriber (chan)]
|
||||
(a/sub <events :body-mousedown subscriber)
|
||||
(a/sub <events :body-scroll subscriber)
|
||||
(go-loop [] (let [event (<! subscriber)]
|
||||
(when-not (dom/click-on-self? (:event event) (om/get-node owner))
|
||||
(when (and (= (:type event) :body-mousedown)
|
||||
(not (dom/click-on-self? (:event event)
|
||||
(om/get-node owner))))
|
||||
(transition-state owner :body-mousedown))
|
||||
(when (= (:type event) :body-scroll)
|
||||
(transition-state owner :scroll))
|
||||
(recur)))))))
|
||||
|
|
Loading…
Reference in a new issue