Mouse property to say what button is being clicked

It follows the convention that already was in the
file 0 for left, 1 for middle and 2 for right.
It also changes to -1 when mouseUp.
This commit is contained in:
KLV
2013-11-03 23:43:47 +01:00
parent cc42a71c66
commit 4593a42a5b
+10 -1
View File
@@ -41,6 +41,11 @@ Phaser.Mouse = function (game) {
* @default
*/
this.mouseUpCallback = null;
/**
* @property {Description} mouseTypeDown - The type of click. -1 for not clicking
* @default
*/
this.mouseTypeDown = -1;
/**
* You can disable all Input by setting disabled = true. While set all new input related events will be ignored.
@@ -119,6 +124,8 @@ Phaser.Mouse.prototype = {
event.preventDefault();
this.mouseTypeDown = event.which - 1;
if (this.mouseDownCallback)
{
this.mouseDownCallback.call(this.callbackContext, event);
@@ -169,6 +176,8 @@ Phaser.Mouse.prototype = {
event.preventDefault();
this.mouseTypeDown = -1;
if (this.mouseUpCallback)
{
this.mouseUpCallback.call(this.callbackContext, event);
@@ -262,4 +271,4 @@ Phaser.Mouse.prototype = {
}
};
};