diff options
| author | Jules Laplace <jules@okfoc.us> | 2017-05-01 12:12:51 -0400 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2017-05-01 12:12:51 -0400 |
| commit | 36ba7852dd91d140a923071cb22fd40998821c23 (patch) | |
| tree | b49ee097adb4d40f88678af1bd15dd9209bfea96 /client/index.js | |
| parent | f6b040e3d4474bfcc92003b9f9ce1a24b6e3cc52 (diff) | |
shouldPreventDefault
Diffstat (limited to 'client/index.js')
| -rw-r--r-- | client/index.js | 9 |
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 = [] |
