Skip to content

Commit d1ea96f

Browse files
committed
Input updates
1 parent 45426be commit d1ea96f

3 files changed

Lines changed: 11 additions & 3 deletions

File tree

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ Phaser is everything we ever wanted from an HTML5 game framework. It will power
3535
Change Log
3636
----------
3737

38+
Version 1.0.6 (in progress)
39+
40+
* Added check into Pointer.move to always consider a Sprite that has pixelPerfect enabled, regardless of render ID.
41+
* BUG Found: The pixel perfect click check doesn't work if the sprite is part of a texture atlas yet.
42+
43+
3844
Version 1.0.5 (September 20th 2013)
3945

4046
* Fixed issue in FrameData.getFrameIndexes where the input array was being ignored.

src/input/InputHandler.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,8 @@ Phaser.InputHandler.prototype = {
367367
if (this.sprite.texture.baseTexture.source)
368368
{
369369
this.game.input.hitContext.clearRect(0, 0, 1, 1);
370+
371+
// This will fail if the image is part of a texture atlas - need to modify the x/y values here
370372
this.game.input.hitContext.drawImage(this.sprite.texture.baseTexture.source, x, y, 1, 1, 0, 0, 1, 1);
371373

372374
var rgb = this.game.input.hitContext.getImageData(0, 0, 1, 1);
@@ -665,7 +667,7 @@ Phaser.InputHandler.prototype = {
665667

666668
this.pixelPerfect = pixelPerfect;
667669
this.pixelPerfectAlpha = alphaThreshold;
668-
670+
669671
if (boundsRect)
670672
{
671673
this.boundsRect = boundsRect;

src/input/Pointer.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,8 +370,8 @@ Phaser.Pointer.prototype = {
370370

371371
do
372372
{
373-
// If the object has a higher InputManager.PriorityID OR if the priority ID is the same as the current highest AND it has a higher renderOrderID, then set it to the top
374-
if (currentNode.priorityID > this._highestInputPriorityID || (currentNode.priorityID == this._highestInputPriorityID && currentNode.sprite.renderOrderID > this._highestRenderOrderID))
373+
// If the object is using pixelPerfect checks, or has a higher InputManager.PriorityID OR if the priority ID is the same as the current highest AND it has a higher renderOrderID, then set it to the top
374+
if (currentNode.pixelPerfect || currentNode.priorityID > this._highestInputPriorityID || (currentNode.priorityID == this._highestInputPriorityID && currentNode.sprite.renderOrderID > this._highestRenderOrderID))
375375
{
376376
if (currentNode.checkPointerOver(this))
377377
{

0 commit comments

Comments
 (0)