Added touch events.
This commit is contained in:
parent
2fba293143
commit
c0f144e556
4 changed files with 35 additions and 6 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -9,3 +9,7 @@ pom.xml.asc
|
||||||
/.nrepl-port
|
/.nrepl-port
|
||||||
\#*\#
|
\#*\#
|
||||||
*~
|
*~
|
||||||
|
.idea
|
||||||
|
freactive.iml
|
||||||
|
out
|
||||||
|
.repl/
|
||||||
|
|
13
resources/public/index.html
Normal file
13
resources/public/index.html
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head lang="en">
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title></title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="root"></div>
|
||||||
|
<script src="js/compiled/out/goog/base.js" type="text/javascript"></script>
|
||||||
|
<script src="js/compiled/app.js" type="text/javascript"></script>
|
||||||
|
<script type="text/javascript">goog.require("freactive.dom_perf");</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
1
resources/public/js/.gitignore
vendored
Normal file
1
resources/public/js/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
compiled/
|
|
@ -23,13 +23,24 @@
|
||||||
|
|
||||||
(defonce init
|
(defonce init
|
||||||
(do
|
(do
|
||||||
(dom/listen! js/window "mousemove" (fn [e]
|
(dom/listen! js/window "mousemove"
|
||||||
(reset! mouse-x (.-clientX e))
|
(fn [e]
|
||||||
(reset! mouse-y (.-clientY e))))
|
(reset! mouse-x (.-clientX e))
|
||||||
|
(reset! mouse-y (.-clientY e))))
|
||||||
|
|
||||||
(dom/listen! js/window "resize" (fn [e]
|
(dom/listen! js/window "resize"
|
||||||
(reset! width (get-window-width))
|
(fn [e]
|
||||||
(reset! height (get-window-height))))))
|
(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]
|
(defn circle [x y]
|
||||||
[:svg/circle {:cx x :cy y :r 2 :stroke "black" :fill "black"}])
|
[:svg/circle {:cx x :cy y :r 2 :stroke "black" :fill "black"}])
|
||||||
|
|
Loading…
Reference in a new issue