summaryrefslogtreecommitdiff
path: root/client/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'client/index.js')
-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 = []