Skip to content

Commit

Permalink
Stop using non-standard, deprecated wheel events
Browse files Browse the repository at this point in the history
  • Loading branch information
Joncom authored Sep 17, 2021
1 parent 17dcee0 commit ca59f0e
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions lib/impact/input.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,7 @@ ig.Input = ig.Class.extend({
initMouse: function() {
if( this.isUsingMouse ) { return; }
this.isUsingMouse = true;
var mouseWheelBound = this.mousewheel.bind(this);
ig.system.canvas.addEventListener('mousewheel', mouseWheelBound, false );
ig.system.canvas.addEventListener('DOMMouseScroll', mouseWheelBound, false );
ig.system.canvas.addEventListener('wheel', this.mousewheel.bind(this), false );

ig.system.canvas.addEventListener('contextmenu', this.contextmenu.bind(this), false );
ig.system.canvas.addEventListener('mousedown', this.keydown.bind(this), false );
Expand Down Expand Up @@ -157,8 +155,7 @@ ig.Input = ig.Class.extend({


mousewheel: function( event ) {
var delta = event.wheelDelta ? event.wheelDelta : (event.detail * -1);
var code = delta > 0 ? ig.KEY.MWHEEL_UP : ig.KEY.MWHEEL_DOWN;
var code = event.deltaY < 0 ? ig.KEY.MWHEEL_UP : ig.KEY.MWHEEL_DOWN;
var action = this.bindings[code];
if( action ) {
this.actions[action] = true;
Expand Down Expand Up @@ -319,4 +316,4 @@ ig.Input = ig.Class.extend({
}
});

});
});

0 comments on commit ca59f0e

Please sign in to comment.