Skip to content

Commit 9649f71

Browse files
committed
InputHandler.checkPointerDown and checkPointerOver will now test the worldTransform scale property of a Sprite. If zero it will fast return, where-as before it would incorrectly report an up event (thanks @jaapaurelio phaserjs#2466)
1 parent 368913f commit 9649f71

3 files changed

Lines changed: 19 additions & 4 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ You can read all about the philosophy behind Lazer [here](http://phaser.io/news/
354354
### Bug Fixes
355355

356356
* Fixed an issue in the Arcade Physics overlap method where it would only detect overlaps up to the max bias threshold and no further (thanks @rgk #2441)
357-
*
357+
* InputHandler.checkPointerDown and checkPointerOver will now test the worldTransform scale property of a Sprite. If zero it will fast return, where-as before it would incorrectly report an up event (thanks @jaapaurelio #2466)
358358
*
359359

360360
### Pixi Updates

src/input/Input.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -956,7 +956,7 @@ Phaser.Input.prototype = {
956956

957957
// Didn't hit the parent, does it have any children?
958958

959-
for (var i = 0, len = displayObject.children.length; i < len; i++)
959+
for (var i = 0; i < displayObject.children.length; i++)
960960
{
961961
if (this.hitTest(displayObject.children[i], pointer, localPoint))
962962
{

src/input/InputHandler.js

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,14 @@ Phaser.InputHandler.prototype = {
678678
*/
679679
checkPointerDown: function (pointer, fastTest) {
680680

681-
if (!pointer.isDown || !this.enabled || !this.sprite || !this.sprite.parent || !this.sprite.visible || !this.sprite.parent.visible)
681+
if (!pointer.isDown ||
682+
!this.enabled ||
683+
!this.sprite ||
684+
!this.sprite.parent ||
685+
!this.sprite.visible ||
686+
!this.sprite.parent.visible ||
687+
this.sprite.worldTransform.a === 0 ||
688+
this.sprite.worldTransform.d === 0)
682689
{
683690
return false;
684691
}
@@ -716,11 +723,19 @@ Phaser.InputHandler.prototype = {
716723
*/
717724
checkPointerOver: function (pointer, fastTest) {
718725

719-
if (!this.enabled || !this.sprite || !this.sprite.parent || !this.sprite.visible || !this.sprite.parent.visible)
726+
if (!pointer.isDown ||
727+
!this.enabled ||
728+
!this.sprite ||
729+
!this.sprite.parent ||
730+
!this.sprite.visible ||
731+
!this.sprite.parent.visible ||
732+
this.sprite.worldTransform.a === 0 ||
733+
this.sprite.worldTransform.d === 0)
720734
{
721735
return false;
722736
}
723737

738+
724739
// Need to pass it a temp point, in case we need it again for the pixel check
725740
if (this.game.input.hitTest(this.sprite, pointer, this._tempPoint))
726741
{

0 commit comments

Comments
 (0)