Skip to content

Commit

Permalink
add event passive options to Matter.Mouse, closes #930, closes #976
Browse files Browse the repository at this point in the history
  • Loading branch information
liabru committed Mar 15, 2023
1 parent 07aec9f commit e888f3c
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/core/Mouse.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
};

/**
Expand Down

0 comments on commit e888f3c

Please sign in to comment.