diff --git a/static/map.js b/static/map.js index 47fd860..a615e3d 100644 --- a/static/map.js +++ b/static/map.js @@ -21,6 +21,7 @@ let center = [0, 0]; let lastPos = [0, 0]; let isMouse = false; let zoom = 1; +let timer = 0; let id = ''; @@ -69,16 +70,26 @@ function mouseDown(e) { } function wheel(e) { + document.body.style.overflow = 'hidden'; + + if (timer != 0) clearTimeout(timer); + + timer = setTimeout(function() { + document.body.style.overflow = ''; + },400) + mpos[0] -= lastPos[0]; mpos[1] -= lastPos[1]; - mpos[0] *= (1.005 ** -e.deltaY) - mpos[1] *= (1.005 ** -e.deltaY) + let f = (2 ** -(e.deltaY/256)); + + mpos[0] *= f; + mpos[1] *= f; mpos[0] += lastPos[0]; mpos[1] += lastPos[1]; - zoom *= (1.005 ** -e.deltaY) + zoom *= f; } function move() {