Skip to content

Commit b580746

Browse files
committed
Input.hitTest now accurately detects hits on the extreme edges of a display object (thanks InsaneHero)
1 parent 7f31cfb commit b580746

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ Version 2.1.3 - "Ravinda" - in development
102102
* Fixed a reference error to the Loader.baseURL in Cache._resolveUrl method (thanks @neurofuzzy #1235)
103103
* Fixed the Filter mouse uniform value population.
104104
* Fixed an issue where audio files with query strings after them would fail the `canPlayAudio` checks (thanks Vithar)
105+
* Input.hitTest now accurately detects hits on the extreme edges of a display object (thanks InsaneHero)
105106

106107
For details about changes made in previous versions of Phaser see the full Change Log at https://github.com/photonstorm/phaser/blob/master/CHANGELOG.md
107108

src/input/Input.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -811,11 +811,11 @@ Phaser.Input.prototype = {
811811
var height = displayObject.texture.frame.height;
812812
var x1 = -width * displayObject.anchor.x;
813813

814-
if (this._localPoint.x > x1 && this._localPoint.x < x1 + width)
814+
if (this._localPoint.x >= x1 && this._localPoint.x < x1 + width)
815815
{
816816
var y1 = -height * displayObject.anchor.y;
817817

818-
if (this._localPoint.y > y1 && this._localPoint.y < y1 + height)
818+
if (this._localPoint.y >= y1 && this._localPoint.y < y1 + height)
819819
{
820820
return true;
821821
}
@@ -827,11 +827,11 @@ Phaser.Input.prototype = {
827827
var height = displayObject.height;
828828
var x1 = -width * displayObject.anchor.x;
829829

830-
if (this._localPoint.x > x1 && this._localPoint.x < x1 + width)
830+
if (this._localPoint.x >= x1 && this._localPoint.x < x1 + width)
831831
{
832832
var y1 = -height * displayObject.anchor.y;
833833

834-
if (this._localPoint.y > y1 && this._localPoint.y < y1 + height)
834+
if (this._localPoint.y >= y1 && this._localPoint.y < y1 + height)
835835
{
836836
return true;
837837
}

0 commit comments

Comments
 (0)