From 50738af77147045bce251ac77176e907b9f2aa06 Mon Sep 17 00:00:00 2001 From: Sebastian Sanabria Date: Sun, 19 May 2024 10:38:49 -0600 Subject: [PATCH] passive listeners - to avoid jank https://developer.mozilla.org/en-US/docs/Glossary/Jank --- src/absulit.points.module.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/absulit.points.module.js b/src/absulit.points.module.js index 7d3b0bd5..832ef2fc 100644 --- a/src/absulit.points.module.js +++ b/src/absulit.points.module.js @@ -118,7 +118,7 @@ export default class Points { this._canvas.addEventListener('click', e => { this._mouseClick = true; }); - this._canvas.addEventListener('mousemove', this._onMouseMove); + this._canvas.addEventListener('mousemove', this._onMouseMove, { passive: true }); this._canvas.addEventListener('mousedown', e => { this._mouseDown = true; }); @@ -129,7 +129,7 @@ export default class Points { this._canvas.addEventListener('wheel', e => { this._mouseWheel = true; this._mouseDelta = [e.deltaX, e.deltaY]; - }); + }, { passive: true }); this._originalCanvasWidth = this._canvas.clientWidth; this._originalCanvasHeigth = this._canvas.clientHeight; window.addEventListener('resize', this._resizeCanvasToFitWindow, false);