diff --git a/src/cljs/grub/view/app.cljs b/src/cljs/grub/view/app.cljs index a317e40..2fdf9b9 100644 --- a/src/cljs/grub/view/app.cljs +++ b/src/cljs/grub/view/app.cljs @@ -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) diff --git a/src/cljs/grub/view/dom.cljs b/src/cljs/grub/view/dom.cljs index 595bc4a..e3cb4f8 100644 --- a/src/cljs/grub/view/dom.cljs +++ b/src/cljs/grub/view/dom.cljs @@ -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)) diff --git a/src/cljs/grub/view/grub.cljs b/src/cljs/grub/view/grub.cljs index 81cad4c..ee6e0a0 100644 --- a/src/cljs/grub/view/grub.cljs +++ b/src/cljs/grub/view/grub.cljs @@ -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 [