Fix checkPointerDown method

checkPointerDown method was a verbatim duplication of checkPointerOver - added pointer.isDown check to passed pointer and altered wording of associated docs to make it clearer what the method is doing.
This commit is contained in:
Lewis Lane 2014-06-22 23:03:15 +01:00
parent 8436bfe3e1
commit 187387126d

View file

@ -610,14 +610,14 @@ Phaser.InputHandler.prototype = {
}, },
/** /**
* Checks if the given pointer is over this Sprite and can click it. * Checks if the given pointer is both down and over this Sprite.
* @method Phaser.InputHandler#checkPointerDown * @method Phaser.InputHandler#checkPointerDown
* @param {Phaser.Pointer} pointer * @param {Phaser.Pointer} pointer
* @return {boolean} True if the pointer is down, otherwise false. * @return {boolean} True if the pointer is down, otherwise false.
*/ */
checkPointerDown: function (pointer) { checkPointerDown: function (pointer) {
if (!this.enabled || !this.sprite || !this.sprite.parent || !this.sprite.visible || !this.sprite.parent.visible) if (!pointer.isDown || !this.enabled || !this.sprite || !this.sprite.parent || !this.sprite.visible || !this.sprite.parent.visible)
{ {
return false; return false;
} }