mirror of
https://github.com/wassname/phaser.git
synced 2026-06-27 16:10:15 +08:00
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:
+10
-1
@@ -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 = {
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user