Skip to content

Commit

Permalink
Update package version with improvements and mouse button support
Browse files Browse the repository at this point in the history
  • Loading branch information
jdnichollsc committed Oct 8, 2018
1 parent db6b805 commit a35bd96
Show file tree
Hide file tree
Showing 10 changed files with 3,471 additions and 17 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "phaser-kinetic-scrolling-plugin",
"version": "1.1.2",
"version": "1.2.0",
"homepage": "https://github.com/jdnichollsc/Phaser-Kinetic-Scrolling-Plugin",
"authors": [
"Juan David Nicholls Cardona <[email protected]>"
Expand Down
14 changes: 10 additions & 4 deletions dist/phaser-kinetic-scrolling-plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @author Juan Nicholls <[email protected]>
* @copyright 2018 Juan Nicholls - http://jdnichollsc.github.io/Phaser-Kinetic-Scrolling-Plugin/
* @license {@link http://opensource.org/licenses/MIT}
* @version 1.1.2
* @version 1.2.0
*/

(function (Phaser) {
Expand Down 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));
2 changes: 1 addition & 1 deletion dist/phaser-kinetic-scrolling-plugin.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion examples/js/example_3.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ var game = new Phaser.Game(1024, 768, Phaser.AUTO, 'phaser-example', {
this.game.kineticScrolling.addClickEvents(sprite, {
down: function () {
console.log('DOWN!');
game.add.tween(sprite).to({ alpha: .5, y: '-10' }, 300, Phaser.Easing.Linear.None, true);
game.add.tween(sprite).to({ alpha: .5, y: '-30' }, 300, Phaser.Easing.Linear.None, true);
},
up: function(){
console.log('UP!');
Expand Down
2 changes: 1 addition & 1 deletion examples/js/example_5.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ var game = new Phaser.Game(1024, 768, Phaser.AUTO, 'phaser-example', {

this.game.kineticScrolling.configure({
onUpdate: function (x, y) {
console.log('x', x, 'y', y);
console.log('x=' + x + ', y='+ y);
}
})
},
Expand Down
14 changes: 10 additions & 4 deletions examples/js/phaser-kinetic-scrolling-plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @author Juan Nicholls <[email protected]>
* @copyright 2018 Juan Nicholls - http://jdnichollsc.github.io/Phaser-Kinetic-Scrolling-Plugin/
* @license {@link http://opensource.org/licenses/MIT}
* @version 1.1.2
* @version 1.2.0
*/

(function (Phaser) {
Expand Down 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));
Loading

0 comments on commit a35bd96

Please sign in to comment.