mirror of
https://github.com/wassname/phaser.git
synced 2026-06-28 16:20:37 +08:00
You can now use the hitArea property on Sprites and Image objects. hitArea can be a geometry object (Rectangle, Circle, Polygon, Ellipse) and is used in pointerOver checks.
This commit is contained in:
@@ -215,7 +215,7 @@ Phaser.InputHandler.prototype = {
|
||||
this.enabled = true;
|
||||
|
||||
// Create the signals the Input component will emit
|
||||
if (this.sprite.events && this.sprite.events.onInputOver == null)
|
||||
if (this.sprite.events && this.sprite.events.onInputOver === null)
|
||||
{
|
||||
this.sprite.events.onInputOver = new Phaser.Signal();
|
||||
this.sprite.events.onInputOut = new Phaser.Signal();
|
||||
@@ -492,11 +492,18 @@ Phaser.InputHandler.prototype = {
|
||||
*/
|
||||
checkPointerOver: function (pointer) {
|
||||
|
||||
if (this.enabled === false || this.sprite.visible === false || (this.sprite.group && this.sprite.group.visible === false))
|
||||
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))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
this.sprite.getLocalUnmodifiedPosition(this._tempPoint, pointer.x, pointer.y);
|
||||
|
||||
if (this._tempPoint.x >= 0 && this._tempPoint.x <= this.sprite.currentFrame.width && this._tempPoint.y >= 0 && this._tempPoint.y <= this.sprite.currentFrame.height)
|
||||
@@ -510,6 +517,9 @@ Phaser.InputHandler.prototype = {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
return false;
|
||||
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user