summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2017-05-01 12:12:51 -0400
committerJules Laplace <jules@okfoc.us>2017-05-01 12:12:51 -0400
commit36ba7852dd91d140a923071cb22fd40998821c23 (patch)
treeb49ee097adb4d40f88678af1bd15dd9209bfea96 /client
parentf6b040e3d4474bfcc92003b9f9ce1a24b6e3cc52 (diff)
shouldPreventDefault
Diffstat (limited to 'client')
-rw-r--r--client/index.js9
1 files changed, 6 insertions, 3 deletions
diff --git a/client/index.js b/client/index.js
index eef40db..a8013c5 100644
--- a/client/index.js
+++ b/client/index.js
@@ -43,7 +43,7 @@ requestAudioContext(init)
function init () {
if (browser.isMobile) {
document.addEventListener('touchstart', touch(down))
- document.addEventListener('touchmove', touch(move))
+ document.addEventListener('touchmove', touch(move, true))
document.addEventListener('touchend', touch(up))
}
else {
@@ -136,8 +136,11 @@ function find(hex){
if (id in hexes) return hexes[id]
return null
}
-function touch(fn){
- return (e) => fn(e.touches[0])
+function touch(fn, shouldPreventDefault){
+ return (e) => {
+ shouldPreventDefault && e.preventDefault()
+ fn(e.touches[0])
+ }
}
function polygon(n, side){
const points = []