mirror of
https://github.com/photonstorm/phaser
synced 2024-11-27 07:01:20 +00:00
Pointer.isUp and isDown are now set in the updateButtons method based on the state of ANY button on the device, jsdocs also updated to reflect this (#1902)
This commit is contained in:
parent
b0a8d3d78c
commit
41d702b485
3 changed files with 26 additions and 39 deletions
|
@ -10,7 +10,8 @@
|
|||
* It will work only in Internet Explorer 10 and Windows Store or Windows Phone 8 apps using JavaScript.
|
||||
* http://msdn.microsoft.com/en-us/library/ie/hh673557(v=vs.85).aspx
|
||||
*
|
||||
* You should not normally access this class directly, but instead use a Phaser.Pointer object which normalises all game input for you.
|
||||
* You should not normally access this class directly, but instead use a Phaser.Pointer object which
|
||||
* normalises all game input for you including accurate button handling.
|
||||
*
|
||||
* @class Phaser.MSPointer
|
||||
* @constructor
|
||||
|
|
|
@ -7,10 +7,12 @@
|
|||
/**
|
||||
* The Mouse class is responsible for handling all aspects of mouse interaction with the browser.
|
||||
*
|
||||
* It captures and processes mouse events that happen on the game canvas object. It also adds a single `mouseup` listener to `window` which
|
||||
* is used to capture the mouse being released when not over the game.
|
||||
* It captures and processes mouse events that happen on the game canvas object.
|
||||
* It also adds a single `mouseup` listener to `window` which is used to capture the mouse being released
|
||||
* when not over the game.
|
||||
*
|
||||
* You should not normally access this class directly, but instead use a Phaser.Pointer object which normalises all game input for you.
|
||||
* You should not normally access this class directly, but instead use a Phaser.Pointer object
|
||||
* which normalises all game input for you, including accurate button handling.
|
||||
*
|
||||
* @class Phaser.Mouse
|
||||
* @constructor
|
||||
|
@ -149,30 +151,6 @@ Phaser.Mouse = function (game) {
|
|||
|
||||
};
|
||||
|
||||
/**
|
||||
* @constant
|
||||
* @type {number}
|
||||
*/
|
||||
Phaser.Mouse.NO_BUTTON = -1;
|
||||
|
||||
/**
|
||||
* @constant
|
||||
* @type {number}
|
||||
*/
|
||||
Phaser.Mouse.LEFT_BUTTON = 0;
|
||||
|
||||
/**
|
||||
* @constant
|
||||
* @type {number}
|
||||
*/
|
||||
Phaser.Mouse.MIDDLE_BUTTON = 1;
|
||||
|
||||
/**
|
||||
* @constant
|
||||
* @type {number}
|
||||
*/
|
||||
Phaser.Mouse.RIGHT_BUTTON = 2;
|
||||
|
||||
/**
|
||||
* @constant
|
||||
* @type {number}
|
||||
|
|
|
@ -210,13 +210,13 @@ Phaser.Pointer = function (game, id) {
|
|||
this.isMouse = false;
|
||||
|
||||
/**
|
||||
* @property {boolean} isDown - If the Pointer is touching the touchscreen, or the mouse button is held down, isDown is set to true.
|
||||
* @property {boolean} isDown - If the Pointer is touching the touchscreen, or *any* mouse button is held down, isDown is set to true.
|
||||
* @default
|
||||
*/
|
||||
this.isDown = false;
|
||||
|
||||
/**
|
||||
* @property {boolean} isUp - If the Pointer is not touching the touchscreen, or the mouse button is up, isUp is set to true.
|
||||
* @property {boolean} isUp - If the Pointer is not touching the touchscreen, or *all* mouse buttons are up, isUp is set to true.
|
||||
* @default
|
||||
*/
|
||||
this.isUp = true;
|
||||
|
@ -381,6 +381,9 @@ Phaser.Pointer.prototype = {
|
|||
this.forwardButton = false;
|
||||
this.eraserButton = false;
|
||||
|
||||
this.isUp = true;
|
||||
this.isDown = false;
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -416,6 +419,15 @@ Phaser.Pointer.prototype = {
|
|||
this.rightButton = true;
|
||||
}
|
||||
|
||||
this.isUp = true;
|
||||
this.isDown = false;
|
||||
|
||||
if (this.leftButton || this.rightButton || this.middleButton || this.backButton || this.forwardButton || this.eraserButton)
|
||||
{
|
||||
this.isUp = false;
|
||||
this.isDown = true;
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -438,8 +450,6 @@ Phaser.Pointer.prototype = {
|
|||
this._history = [];
|
||||
this.active = true;
|
||||
this.withinGame = true;
|
||||
this.isDown = true;
|
||||
this.isUp = false;
|
||||
this.dirty = false;
|
||||
this._clickTrampolines = null;
|
||||
this._trampolineTargetObject = null;
|
||||
|
@ -791,8 +801,6 @@ Phaser.Pointer.prototype = {
|
|||
}
|
||||
|
||||
this.withinGame = false;
|
||||
this.isDown = false;
|
||||
this.isUp = true;
|
||||
this.pointerId = null;
|
||||
this.identifier = null;
|
||||
|
||||
|
@ -844,7 +852,7 @@ Phaser.Pointer.prototype = {
|
|||
|
||||
duration = duration || this.game.input.justReleasedRate;
|
||||
|
||||
return (this.isUp === true && (this.timeUp + duration) > this.game.time.time);
|
||||
return (this.isUp && (this.timeUp + duration) > this.game.time.time);
|
||||
|
||||
},
|
||||
|
||||
|
@ -936,8 +944,6 @@ Phaser.Pointer.prototype = {
|
|||
this.pointerId = null;
|
||||
this.identifier = null;
|
||||
this.dirty = false;
|
||||
this.isDown = false;
|
||||
this.isUp = true;
|
||||
this.totalTouches = 0;
|
||||
this._holdSent = false;
|
||||
this._history.length = 0;
|
||||
|
@ -970,9 +976,11 @@ Phaser.Pointer.prototype = {
|
|||
Phaser.Pointer.prototype.constructor = Phaser.Pointer;
|
||||
|
||||
/**
|
||||
* How long the Pointer has been depressed on the touchscreen. If not currently down it returns -1.
|
||||
* How long the Pointer has been depressed on the touchscreen or *any* of the mouse buttons have been held down.
|
||||
* If not currently down it returns -1.
|
||||
*
|
||||
* @name Phaser.Pointer#duration
|
||||
* @property {number} duration - How long the Pointer has been depressed on the touchscreen. If not currently down it returns -1.
|
||||
* @property {number} duration
|
||||
* @readonly
|
||||
*/
|
||||
Object.defineProperty(Phaser.Pointer.prototype, "duration", {
|
||||
|
|
Loading…
Reference in a new issue