Skip to content

Commit

Permalink
Usa passive event listeners
Browse files Browse the repository at this point in the history
  • Loading branch information
lovasoa committed Jan 17, 2019
1 parent caf56bd commit 014f564
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions client-data/tools/zoom/zoom.js
Expand Up @@ -91,14 +91,12 @@
window.scrollTo(window.scrollX + evt.deltaX, window.scrollY + evt.deltaY);
}
}
Tools.board.addEventListener("wheel", onwheel);
Tools.board.addEventListener("wheel", onwheel, { passive: false });

Tools.board.addEventListener("touchmove", function ontouchmove(evt) {
// 2-finger pan to zoom
var touches = evt.touches;
if (touches.length === 2) {
evt.preventDefault();
evt.stopPropagation();
var x0 = touches[0].clientX, x1 = touches[1].clientX,
y0 = touches[0].clientY, y1 = touches[1].clientY,
dx = x0 - x1,
Expand All @@ -116,7 +114,7 @@
animate(scale);
}
}
});
}, { passive: true });
function touchend() {
pressed = false;
}
Expand Down

0 comments on commit 014f564

Please sign in to comment.