Skip to content

Commit

Permalink
Merge pull request #14 from radarsu/master
Browse files Browse the repository at this point in the history
added optional setting for button
  • Loading branch information
jdnichollsc authored Oct 8, 2018
2 parents 3dcb036 + fe81fe7 commit db6b805
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/phaser-kinetic-scrolling-plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@
horizontalWheel: true,
verticalWheel: false,
deltaWheel: 40,
onUpdate: null
onUpdate: null,
button: ""
};
};

Expand All @@ -83,6 +84,7 @@
* @param {boolean} [options.horizontalWheel=true] - Enable or Disable the horizontal scrolling with mouse wheel.
* @param {boolean} [options.verticalWheel=false] - Enable or Disable the vertical scrolling with mouse wheel.
* @param {number} [options.deltaWheel=40] - Delta increment of the mouse wheel.
* @param {string} [options.button=""] - Phaser button code to start drag, LEFT_BUTTON, RIGHT_BUTTON, etc.
*/
Phaser.Plugin.KineticScrolling.prototype.configure = function (options) {

Expand Down Expand Up @@ -116,7 +118,11 @@
* Event triggered when a pointer is pressed down, resets the value of variables.
*/
Phaser.Plugin.KineticScrolling.prototype.beginMove = function (pointer) {


if (this.settings.button && pointer.button !== Phaser.Mouse[this.settings.button]) {
return;
}

this.pointerId = pointer.id;
this.startX = this.game.input.x;
this.startY = this.game.input.y;
Expand Down Expand Up @@ -475,4 +481,4 @@

};

}(Phaser));
}(Phaser));

0 comments on commit db6b805

Please sign in to comment.