aboutsummaryrefslogtreecommitdiffhomepage
path: root/ui/static/js/touch_handler.js
diff options
context:
space:
mode:
Diffstat (limited to 'ui/static/js/touch_handler.js')
-rw-r--r--ui/static/js/touch_handler.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/ui/static/js/touch_handler.js b/ui/static/js/touch_handler.js
index 69488a5..a6c5c81 100644
--- a/ui/static/js/touch_handler.js
+++ b/ui/static/js/touch_handler.js
@@ -83,12 +83,13 @@ class TouchHandler {
listen() {
let elements = document.querySelectorAll(".touch-item");
+ let hasPassiveOption = DomHelper.hasPassiveEventListenerOption();
elements.forEach((element) => {
- element.addEventListener("touchstart", (e) => this.onTouchStart(e), false);
- element.addEventListener("touchmove", (e) => this.onTouchMove(e), false);
- element.addEventListener("touchend", (e) => this.onTouchEnd(e), false);
- element.addEventListener("touchcancel", () => this.reset(), false);
+ element.addEventListener("touchstart", (e) => this.onTouchStart(e), hasPassiveOption ? { passive: true } : false);
+ element.addEventListener("touchmove", (e) => this.onTouchMove(e), hasPassiveOption ? { passive: true } : false);
+ element.addEventListener("touchend", (e) => this.onTouchEnd(e), hasPassiveOption ? { passive: true } : false);
+ element.addEventListener("touchcancel", () => this.reset(), hasPassiveOption ? { passive: true } : false);
});
}
}