World.wrap when using the bounds of the object wouldn't adjust the bounds correctly, meaning wrapping outside the camera failed (thanks @jackrugile #1020)

This commit is contained in:
photonstorm 2014-07-15 14:22:06 +01:00
parent f77b4d4e8f
commit 538425193a
3 changed files with 28 additions and 25 deletions

View file

@ -53,6 +53,8 @@ Version 2.0.7 - "Amadicia" - -in development-
* TypeScript definitions fixes and updates (thanks @clark-stevenson and @alvinsight)
* 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)
* 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.
* InputHandler.checkPointerOver now has a new `fastTest` parameter that forces a skips a pixel perfect check even if enabled.
* InputHandler.checkPointerDown now has a new `fastTest` parameter that forces a skips a pixel perfect check even if enabled.
### New Features
@ -66,18 +68,9 @@ Version 2.0.7 - "Amadicia" - -in development-
* Added missing Loader.onPackComplete Signal (thanks @mjeffery #1007)
* QuadTree leveling - Rather than level++ which changes the current nodes level, the subnodes should get the current nodes level+1 (thanks @devinb83 #1018)
* Prevented objects with pixel perfect checks from over-riding other higher priority ID items (#983)
* Group.create was not creating with p2 debug flag (thanks @Dumtard #1014)
* World.wrap when using the bounds of the object wouldn't adjust the bounds correctly, meaning wrapping outside the camera failed (thanks @jackrugile #1020)
### TODO
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)
Allow multiple drag items - no longer bind just 1 to a Pointer
Sweep and Prune objects to filter priority IDs.
Allow Groups to have Priority IDs too and input disable entire Groups and all children (let it flow down the chain)
Allow Groups to be InputEnabled? Dragging a Group would be really useful.
@ -256,6 +249,10 @@ Here are some of the features planned for future releases:
### Version 2.2 ("Tarabon")
* 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)
* Allow multiple drag items - no longer bind just 1 to a Pointer
* Allow Groups to have Priority IDs too and input disable entire Groups and all children (let it flow down the chain)
* Allow Groups to be InputEnabled? Dragging a Group would be really useful.
* Scene Manager - json scene parser.
* Comprehensive testing across Firefox OS devices, CocoonJS and Ejecta.
* Ability to control DOM elements from the core game and layer them into the game.

View file

@ -146,22 +146,28 @@ Phaser.World.prototype.wrap = function (sprite, padding, useBounds, horizontal,
{
sprite.getBounds();
if (horizontal && sprite._currentBounds.right < this.bounds.x)
if (horizontal)
{
sprite.x = this.bounds.right;
}
else if (horizontal && sprite._currentBounds.x > this.bounds.right)
{
sprite.x = this.bounds.left;
if ((sprite.x + sprite._currentBounds.width) < this.bounds.x)
{
sprite.x = this.bounds.right;
}
else if (sprite.x > this.bounds.right)
{
sprite.x = this.bounds.left;
}
}
if (vertical && sprite._currentBounds.bottom < this.bounds.top)
if (vertical)
{
sprite.y = this.bounds.bottom;
}
else if (vertical && sprite._currentBounds.top > this.bounds.bottom)
{
sprite.y = this.bounds.top;
if ((sprite.y + sprite._currentBounds.height) < this.bounds.top)
{
sprite.y = this.bounds.bottom;
}
else if (sprite.y > this.bounds.bottom)
{
sprite.y = this.bounds.top;
}
}
}

View file

@ -472,7 +472,7 @@ Phaser.Pointer.prototype = {
// Flag it as checked so we don't re-scan it on the next phase
currentNode.checked = true;
if ((!fromClick && currentNode.checkPointerOver(this, true)) || (fromClick && currentNode.checkPointerDown(this, true)))
if ((fromClick && currentNode.checkPointerDown(this, true)) || (!fromClick && currentNode.checkPointerOver(this, true)))
{
this._highestRenderOrderID = currentNode.sprite._cache[3]; // renderOrderID
this._highestInputPriorityID = currentNode.priorityID;
@ -492,7 +492,7 @@ Phaser.Pointer.prototype = {
{
if (currentNode && !currentNode.checked && currentNode.validForInput(this._highestInputPriorityID, this._highestRenderOrderID, true))
{
if ((!fromClick && currentNode.checkPointerOver(this, false)) || (fromClick && currentNode.checkPointerDown(this, false)))
if ((fromClick && currentNode.checkPointerDown(this, false)) || (!fromClick && currentNode.checkPointerOver(this, false)))
{
this._highestRenderOrderID = currentNode.sprite._cache[3]; // renderOrderID
this._highestInputPriorityID = currentNode.priorityID;