Skip to content

Commit 5384251

Browse files
committed
World.wrap when using the bounds of the object wouldn't adjust the bounds correctly, meaning wrapping outside the camera failed (thanks @jackrugile phaserjs#1020)
1 parent f77b4d4 commit 5384251

3 files changed

Lines changed: 28 additions & 25 deletions

File tree

README.md

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ Version 2.0.7 - "Amadicia" - -in development-
5353
* TypeScript definitions fixes and updates (thanks @clark-stevenson and @alvinsight)
5454
* GameObjectFactory.spriteBatch now lets you specify `null` as a parameter for the parent and automatically adds the batch to `game.world` as a result. Also fixed jsdocs issues (@petarov #1000)
5555
* Rebuilt the way items are polled for Pointer events (drag, click, move). Now faster and more efficient, especially when some items in the stack require pixel perfect checks.
56+
* InputHandler.checkPointerOver now has a new `fastTest` parameter that forces a skips a pixel perfect check even if enabled.
57+
* InputHandler.checkPointerDown now has a new `fastTest` parameter that forces a skips a pixel perfect check even if enabled.
5658

5759
### New Features
5860

@@ -66,18 +68,9 @@ Version 2.0.7 - "Amadicia" - -in development-
6668
* Added missing Loader.onPackComplete Signal (thanks @mjeffery #1007)
6769
* QuadTree leveling - Rather than level++ which changes the current nodes level, the subnodes should get the current nodes level+1 (thanks @devinb83 #1018)
6870
* Prevented objects with pixel perfect checks from over-riding other higher priority ID items (#983)
71+
* Group.create was not creating with p2 debug flag (thanks @Dumtard #1014)
72+
* World.wrap when using the bounds of the object wouldn't adjust the bounds correctly, meaning wrapping outside the camera failed (thanks @jackrugile #1020)
6973

70-
### TODO
71-
72-
Adjust how Pointers and Interactive Objects work. Allow an IO to be flagged as "on click only", so it doesn't ever get processed during normal Pointer move events (unless being dragged)
73-
74-
Allow multiple drag items - no longer bind just 1 to a Pointer
75-
76-
Sweep and Prune objects to filter priority IDs.
77-
78-
Allow Groups to have Priority IDs too and input disable entire Groups and all children (let it flow down the chain)
79-
80-
Allow Groups to be InputEnabled? Dragging a Group would be really useful.
8174

8275

8376

@@ -256,6 +249,10 @@ Here are some of the features planned for future releases:
256249

257250
### Version 2.2 ("Tarabon")
258251

252+
* Adjust how Pointers and Interactive Objects work. Allow an IO to be flagged as "on click only", so it doesn't ever get processed during normal Pointer move events (unless being dragged)
253+
* Allow multiple drag items - no longer bind just 1 to a Pointer
254+
* Allow Groups to have Priority IDs too and input disable entire Groups and all children (let it flow down the chain)
255+
* Allow Groups to be InputEnabled? Dragging a Group would be really useful.
259256
* Scene Manager - json scene parser.
260257
* Comprehensive testing across Firefox OS devices, CocoonJS and Ejecta.
261258
* Ability to control DOM elements from the core game and layer them into the game.

src/core/World.js

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -146,22 +146,28 @@ Phaser.World.prototype.wrap = function (sprite, padding, useBounds, horizontal,
146146
{
147147
sprite.getBounds();
148148

149-
if (horizontal && sprite._currentBounds.right < this.bounds.x)
149+
if (horizontal)
150150
{
151-
sprite.x = this.bounds.right;
152-
}
153-
else if (horizontal && sprite._currentBounds.x > this.bounds.right)
154-
{
155-
sprite.x = this.bounds.left;
151+
if ((sprite.x + sprite._currentBounds.width) < this.bounds.x)
152+
{
153+
sprite.x = this.bounds.right;
154+
}
155+
else if (sprite.x > this.bounds.right)
156+
{
157+
sprite.x = this.bounds.left;
158+
}
156159
}
157160

158-
if (vertical && sprite._currentBounds.bottom < this.bounds.top)
159-
{
160-
sprite.y = this.bounds.bottom;
161-
}
162-
else if (vertical && sprite._currentBounds.top > this.bounds.bottom)
161+
if (vertical)
163162
{
164-
sprite.y = this.bounds.top;
163+
if ((sprite.y + sprite._currentBounds.height) < this.bounds.top)
164+
{
165+
sprite.y = this.bounds.bottom;
166+
}
167+
else if (sprite.y > this.bounds.bottom)
168+
{
169+
sprite.y = this.bounds.top;
170+
}
165171
}
166172
}
167173

src/input/Pointer.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ Phaser.Pointer.prototype = {
472472
// Flag it as checked so we don't re-scan it on the next phase
473473
currentNode.checked = true;
474474

475-
if ((!fromClick && currentNode.checkPointerOver(this, true)) || (fromClick && currentNode.checkPointerDown(this, true)))
475+
if ((fromClick && currentNode.checkPointerDown(this, true)) || (!fromClick && currentNode.checkPointerOver(this, true)))
476476
{
477477
this._highestRenderOrderID = currentNode.sprite._cache[3]; // renderOrderID
478478
this._highestInputPriorityID = currentNode.priorityID;
@@ -492,7 +492,7 @@ Phaser.Pointer.prototype = {
492492
{
493493
if (currentNode && !currentNode.checked && currentNode.validForInput(this._highestInputPriorityID, this._highestRenderOrderID, true))
494494
{
495-
if ((!fromClick && currentNode.checkPointerOver(this, false)) || (fromClick && currentNode.checkPointerDown(this, false)))
495+
if ((fromClick && currentNode.checkPointerDown(this, false)) || (!fromClick && currentNode.checkPointerOver(this, false)))
496496
{
497497
this._highestRenderOrderID = currentNode.sprite._cache[3]; // renderOrderID
498498
this._highestInputPriorityID = currentNode.priorityID;

0 commit comments

Comments
 (0)