mirror of
https://github.com/wassname/phaser.git
synced 2026-06-28 16:20:37 +08:00
Updated to Pixi 1.5 final.
InputHandler.pixelPerfectOver - performs a pixel perfect check to see if any pointer is over the current object (warning: very expensive!) InputHandler.pixelPerfectClick - performs a pixel perfect check but only when the pointer touches/clicks on the current object.
This commit is contained in:
@@ -502,6 +502,36 @@ Phaser.InputHandler.prototype = {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Checks if the given pointer is over this Sprite and can click it.
|
||||
* @method Phaser.InputHandler#checkPointerDown
|
||||
* @param {Phaser.Pointer} pointer
|
||||
* @return {boolean}
|
||||
*/
|
||||
checkPointerDown: function (pointer) {
|
||||
|
||||
if (this.enabled === false || this.sprite.visible === false || this.sprite.parent.visible === false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Need to pass it a temp point, in case we need it again for the pixel check
|
||||
if (this.game.input.hitTest(this.sprite, pointer, this._tempPoint))
|
||||
{
|
||||
if (this.pixelPerfectClick)
|
||||
{
|
||||
return this.checkPixel(this._tempPoint.x, this._tempPoint.y);
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Checks if the given pointer is over this Sprite.
|
||||
* @method Phaser.InputHandler#checkPointerOver
|
||||
|
||||
Reference in New Issue
Block a user