diff --git a/.gitignore b/.gitignore index 18bd849..1444fac 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,7 @@ pom.xml.asc /.nrepl-port \#*\# *~ +.idea +freactive.iml +out +.repl/ diff --git a/resources/public/index.html b/resources/public/index.html new file mode 100644 index 0000000..21a7af1 --- /dev/null +++ b/resources/public/index.html @@ -0,0 +1,13 @@ + + + + + + + +
+ + + + + \ No newline at end of file diff --git a/resources/public/js/.gitignore b/resources/public/js/.gitignore new file mode 100644 index 0000000..d54f0d0 --- /dev/null +++ b/resources/public/js/.gitignore @@ -0,0 +1 @@ +compiled/ \ No newline at end of file diff --git a/test/freactive/dom_perf.cljs b/test/freactive/dom_perf.cljs index c1c931f..0d25fe0 100644 --- a/test/freactive/dom_perf.cljs +++ b/test/freactive/dom_perf.cljs @@ -23,13 +23,24 @@ (defonce init (do - (dom/listen! js/window "mousemove" (fn [e] - (reset! mouse-x (.-clientX e)) - (reset! mouse-y (.-clientY e)))) + (dom/listen! js/window "mousemove" + (fn [e] + (reset! mouse-x (.-clientX e)) + (reset! mouse-y (.-clientY e)))) - (dom/listen! js/window "resize" (fn [e] - (reset! width (get-window-width)) - (reset! height (get-window-height)))))) + (dom/listen! js/window "resize" + (fn [e] + (reset! width (get-window-width)) + (reset! height (get-window-height)))) + + (dom/listen! js/window "touchmove" + (fn [e] + (let [touches (.-touches e)] + (when (= 1 (alength touches)) + (.preventDefault e) + (let [touch (aget touches 0)] + (reset! mouse-x (.-clientX touch)) + (reset! mouse-y (.-clientY touch))))))))) (defn circle [x y] [:svg/circle {:cx x :cy y :r 2 :stroke "black" :fill "black"}])