0
0
Fork 0
mirror of https://github.com/liabru/matter-js.git synced 2025-01-13 16:18:50 -05:00

add event passive options to Matter.Mouse, closes #930, closes #976

This commit is contained in:
liabru 2023-03-15 23:36:40 +00:00
parent 07aec9ff5e
commit e888f3cfda

View file

@ -116,16 +116,15 @@ var Common = require('../core/Common');
Mouse.setElement = function(mouse, element) {
mouse.element = element;
element.addEventListener('mousemove', mouse.mousemove);
element.addEventListener('mousedown', mouse.mousedown);
element.addEventListener('mouseup', mouse.mouseup);
element.addEventListener('mousemove', mouse.mousemove, { passive: true });
element.addEventListener('mousedown', mouse.mousedown, { passive: true });
element.addEventListener('mouseup', mouse.mouseup, { passive: true });
element.addEventListener('mousewheel', mouse.mousewheel);
element.addEventListener('DOMMouseScroll', mouse.mousewheel);
element.addEventListener('touchmove', mouse.mousemove);
element.addEventListener('touchstart', mouse.mousedown);
element.addEventListener('touchend', mouse.mouseup);
element.addEventListener('wheel', mouse.mousewheel, { passive: false });
element.addEventListener('touchmove', mouse.mousemove, { passive: false });
element.addEventListener('touchstart', mouse.mousedown, { passive: false });
element.addEventListener('touchend', mouse.mouseup, { passive: false });
};
/**