mirror of
https://github.com/photonstorm/phaser
synced 2024-09-21 23:12:07 +00:00
Fixed issue where Image, Sprite, etc wouldn't call preUpdate or postUpdate of its children.
Fixed issue where renderOrderID wasn't being assigned correctly, causing the Input Handler to be unable to select the "top" item on a display list (would all default to zero) Fixed issue where Stage would assign renderOrderIDs in reverse, should be in sequence. Fixed issue where objects where checking World for the currentRenderOrderID by mistake instead of Stage. Basically, input handling works a lot better now for Groups and nested objects :)
This commit is contained in:
parent
8dcfef8db0
commit
664d5b3e2c
14 changed files with 226 additions and 76 deletions
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
* Phaser - http://www.phaser.io
|
||||
*
|
||||
* v2.0.0 "Aes Sedai" - Built: Fri Feb 28 2014 18:53:23
|
||||
* v2.0.0 "Aes Sedai" - Built: Fri Feb 28 2014 19:43:09
|
||||
*
|
||||
* By Richard Davey http://www.photonstorm.com @photonstorm
|
||||
*
|
||||
|
@ -5315,6 +5315,11 @@ Phaser.Stage = function (game, width, height) {
|
|||
*/
|
||||
this.exists = true;
|
||||
|
||||
/**
|
||||
* @property {number} currentRenderOrderID - Reset each frame, keeps a count of the total number of objects updated.
|
||||
*/
|
||||
this.currentRenderOrderID = 0;
|
||||
|
||||
/**
|
||||
* @property {string} hiddenVar - The page visibility API event name.
|
||||
* @private
|
||||
|
@ -5358,9 +5363,10 @@ Phaser.Stage.prototype.preUpdate = function () {
|
|||
|
||||
this.currentRenderOrderID = 0;
|
||||
|
||||
var i = this.children.length;
|
||||
// This can't loop in reverse, we need the orderID to be in sequence
|
||||
var len = this.children.length;
|
||||
|
||||
while (i--)
|
||||
for (var i = 0; i < len; i++)
|
||||
{
|
||||
this.children[i].preUpdate();
|
||||
}
|
||||
|
@ -7058,11 +7064,6 @@ Phaser.World = function (game) {
|
|||
* @property {Phaser.Camera} camera - Camera instance.
|
||||
*/
|
||||
this.camera = null;
|
||||
|
||||
/**
|
||||
* @property {number} currentRenderOrderID - Reset each frame, keeps a count of the total number of objects updated.
|
||||
*/
|
||||
this.currentRenderOrderID = 0;
|
||||
|
||||
}
|
||||
|
||||
|
@ -11227,7 +11228,7 @@ Phaser.Pointer.prototype = {
|
|||
}
|
||||
|
||||
// Work out which object is on the top
|
||||
this._highestRenderOrderID = -1;
|
||||
this._highestRenderOrderID = Number.MAX_SAFE_INTEGER;
|
||||
this._highestRenderObject = null;
|
||||
this._highestInputPriorityID = -1;
|
||||
|
||||
|
@ -11239,11 +11240,11 @@ Phaser.Pointer.prototype = {
|
|||
do
|
||||
{
|
||||
// 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
|
||||
if (currentNode.pixelPerfectClick || currentNode.pixelPerfectOver || currentNode.priorityID > this._highestInputPriorityID || (currentNode.priorityID === this._highestInputPriorityID && currentNode.sprite.renderOrderID > this._highestRenderOrderID))
|
||||
if (currentNode.pixelPerfectClick || currentNode.pixelPerfectOver || currentNode.priorityID > this._highestInputPriorityID || (currentNode.priorityID === this._highestInputPriorityID && currentNode.sprite._cache[3] < this._highestRenderOrderID))
|
||||
{
|
||||
if ((!fromClick && currentNode.checkPointerOver(this)) || (fromClick && currentNode.checkPointerDown(this)))
|
||||
{
|
||||
this._highestRenderOrderID = currentNode.sprite.renderOrderID;
|
||||
this._highestRenderOrderID = currentNode.sprite._cache[3]; // renderOrderID
|
||||
this._highestInputPriorityID = currentNode.priorityID;
|
||||
this._highestRenderObject = currentNode;
|
||||
}
|
||||
|
@ -15965,14 +15966,15 @@ Phaser.Sprite.prototype.preUpdate = function() {
|
|||
|
||||
if (this.visible)
|
||||
{
|
||||
this._cache[3] = this.game.world.currentRenderOrderID++;
|
||||
this._cache[3] = this.game.stage.currentRenderOrderID++;
|
||||
}
|
||||
|
||||
this.animations.update();
|
||||
|
||||
if (this.body)
|
||||
// Update any Children
|
||||
for (var i = 0, len = this.children.length; i < len; i++)
|
||||
{
|
||||
// this.body.preUpdate();
|
||||
this.children[i].preUpdate();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -15981,6 +15983,7 @@ Phaser.Sprite.prototype.preUpdate = function() {
|
|||
|
||||
/**
|
||||
* Override and use this function in your own custom objects to handle any update requirements you may have.
|
||||
* Remember if this Sprite has any children you should call update on them too.
|
||||
*
|
||||
* @method Phaser.Sprite#update
|
||||
* @memberof Phaser.Sprite
|
||||
|
@ -16017,6 +16020,12 @@ Phaser.Sprite.prototype.postUpdate = function() {
|
|||
this.position.y = this.game.camera.view.y + this.cameraOffset.y;
|
||||
}
|
||||
|
||||
// Update any Children
|
||||
for (var i = 0, len = this.children.length; i < len; i++)
|
||||
{
|
||||
this.children[i].postUpdate();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -16852,7 +16861,7 @@ Phaser.Image.prototype.preUpdate = function() {
|
|||
|
||||
if (!this.exists || !this.parent.exists)
|
||||
{
|
||||
this.renderOrderID = -1;
|
||||
this._cache[3] = -1;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -16866,7 +16875,13 @@ Phaser.Image.prototype.preUpdate = function() {
|
|||
|
||||
if (this.visible)
|
||||
{
|
||||
this._cache[3] = this.game.world.currentRenderOrderID++;
|
||||
this._cache[3] = this.game.stage.currentRenderOrderID++;
|
||||
}
|
||||
|
||||
// Update any Children
|
||||
for (var i = 0, len = this.children.length; i < len; i++)
|
||||
{
|
||||
this.children[i].preUpdate();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -16903,6 +16918,12 @@ Phaser.Image.prototype.postUpdate = function() {
|
|||
this.position.y = this.game.camera.view.y + this.cameraOffset.y;
|
||||
}
|
||||
|
||||
// Update any Children
|
||||
for (var i = 0, len = this.children.length; i < len; i++)
|
||||
{
|
||||
this.children[i].postUpdate();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -17615,6 +17636,17 @@ Phaser.TileSprite.prototype.preUpdate = function() {
|
|||
this.tilePosition.y += this._scroll.y * this.game.time.physicsElapsed;
|
||||
}
|
||||
|
||||
if (this.visible)
|
||||
{
|
||||
this._cache[3] = this.game.stage.currentRenderOrderID++;
|
||||
}
|
||||
|
||||
// Update any Children
|
||||
for (var i = 0, len = this.children.length; i < len; i++)
|
||||
{
|
||||
this.children[i].preUpdate();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
@ -17644,6 +17676,12 @@ Phaser.TileSprite.prototype.postUpdate = function() {
|
|||
this.position.y = this.game.camera.view.y + this.cameraOffset.y;
|
||||
}
|
||||
|
||||
// Update any Children
|
||||
for (var i = 0, len = this.children.length; i < len; i++)
|
||||
{
|
||||
this.children[i].postUpdate();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -18107,7 +18145,13 @@ Phaser.Text.prototype.preUpdate = function () {
|
|||
|
||||
if (this.visible)
|
||||
{
|
||||
this._cache[3] = this.game.world.currentRenderOrderID++;
|
||||
this._cache[3] = this.game.stage.currentRenderOrderID++;
|
||||
}
|
||||
|
||||
// Update any Children
|
||||
for (var i = 0, len = this.children.length; i < len; i++)
|
||||
{
|
||||
this.children[i].preUpdate();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -18136,6 +18180,12 @@ Phaser.Text.prototype.postUpdate = function () {
|
|||
this.position.y = this.game.camera.view.y + this.cameraOffset.y;
|
||||
}
|
||||
|
||||
// Update any Children
|
||||
for (var i = 0, len = this.children.length; i < len; i++)
|
||||
{
|
||||
this.children[i].postUpdate();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -18967,7 +19017,7 @@ Phaser.BitmapText.prototype.preUpdate = function () {
|
|||
|
||||
if (this.visible)
|
||||
{
|
||||
this._cache[3] = this.game.world.currentRenderOrderID++;
|
||||
this._cache[3] = this.game.stage.currentRenderOrderID++;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -19997,7 +20047,7 @@ Phaser.Graphics.prototype.preUpdate = function () {
|
|||
|
||||
if (this.visible)
|
||||
{
|
||||
this._cache[3] = this.game.world.currentRenderOrderID++;
|
||||
this._cache[3] = this.game.stage.currentRenderOrderID++;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
18
build/custom/phaser-no-libs.min.js
vendored
18
build/custom/phaser-no-libs.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
* Phaser - http://www.phaser.io
|
||||
*
|
||||
* v2.0.0 "Aes Sedai" - Built: Fri Feb 28 2014 18:53:23
|
||||
* v2.0.0 "Aes Sedai" - Built: Fri Feb 28 2014 19:43:09
|
||||
*
|
||||
* By Richard Davey http://www.photonstorm.com @photonstorm
|
||||
*
|
||||
|
@ -20265,7 +20265,7 @@ PIXI.RenderTexture.tempMatrix = new PIXI.Matrix();
|
|||
*
|
||||
* Phaser - http://www.phaser.io
|
||||
*
|
||||
* v2.0.0 "Aes Sedai" - Built: Fri Feb 28 2014 18:53:23
|
||||
* v2.0.0 "Aes Sedai" - Built: Fri Feb 28 2014 19:43:09
|
||||
*
|
||||
* By Richard Davey http://www.photonstorm.com @photonstorm
|
||||
*
|
||||
|
@ -25573,6 +25573,11 @@ Phaser.Stage = function (game, width, height) {
|
|||
*/
|
||||
this.exists = true;
|
||||
|
||||
/**
|
||||
* @property {number} currentRenderOrderID - Reset each frame, keeps a count of the total number of objects updated.
|
||||
*/
|
||||
this.currentRenderOrderID = 0;
|
||||
|
||||
/**
|
||||
* @property {string} hiddenVar - The page visibility API event name.
|
||||
* @private
|
||||
|
@ -25616,9 +25621,10 @@ Phaser.Stage.prototype.preUpdate = function () {
|
|||
|
||||
this.currentRenderOrderID = 0;
|
||||
|
||||
var i = this.children.length;
|
||||
// This can't loop in reverse, we need the orderID to be in sequence
|
||||
var len = this.children.length;
|
||||
|
||||
while (i--)
|
||||
for (var i = 0; i < len; i++)
|
||||
{
|
||||
this.children[i].preUpdate();
|
||||
}
|
||||
|
@ -27316,11 +27322,6 @@ Phaser.World = function (game) {
|
|||
* @property {Phaser.Camera} camera - Camera instance.
|
||||
*/
|
||||
this.camera = null;
|
||||
|
||||
/**
|
||||
* @property {number} currentRenderOrderID - Reset each frame, keeps a count of the total number of objects updated.
|
||||
*/
|
||||
this.currentRenderOrderID = 0;
|
||||
|
||||
}
|
||||
|
||||
|
@ -31485,7 +31486,7 @@ Phaser.Pointer.prototype = {
|
|||
}
|
||||
|
||||
// Work out which object is on the top
|
||||
this._highestRenderOrderID = -1;
|
||||
this._highestRenderOrderID = Number.MAX_SAFE_INTEGER;
|
||||
this._highestRenderObject = null;
|
||||
this._highestInputPriorityID = -1;
|
||||
|
||||
|
@ -31497,11 +31498,11 @@ Phaser.Pointer.prototype = {
|
|||
do
|
||||
{
|
||||
// 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
|
||||
if (currentNode.pixelPerfectClick || currentNode.pixelPerfectOver || currentNode.priorityID > this._highestInputPriorityID || (currentNode.priorityID === this._highestInputPriorityID && currentNode.sprite.renderOrderID > this._highestRenderOrderID))
|
||||
if (currentNode.pixelPerfectClick || currentNode.pixelPerfectOver || currentNode.priorityID > this._highestInputPriorityID || (currentNode.priorityID === this._highestInputPriorityID && currentNode.sprite._cache[3] < this._highestRenderOrderID))
|
||||
{
|
||||
if ((!fromClick && currentNode.checkPointerOver(this)) || (fromClick && currentNode.checkPointerDown(this)))
|
||||
{
|
||||
this._highestRenderOrderID = currentNode.sprite.renderOrderID;
|
||||
this._highestRenderOrderID = currentNode.sprite._cache[3]; // renderOrderID
|
||||
this._highestInputPriorityID = currentNode.priorityID;
|
||||
this._highestRenderObject = currentNode;
|
||||
}
|
||||
|
@ -36223,14 +36224,15 @@ Phaser.Sprite.prototype.preUpdate = function() {
|
|||
|
||||
if (this.visible)
|
||||
{
|
||||
this._cache[3] = this.game.world.currentRenderOrderID++;
|
||||
this._cache[3] = this.game.stage.currentRenderOrderID++;
|
||||
}
|
||||
|
||||
this.animations.update();
|
||||
|
||||
if (this.body)
|
||||
// Update any Children
|
||||
for (var i = 0, len = this.children.length; i < len; i++)
|
||||
{
|
||||
// this.body.preUpdate();
|
||||
this.children[i].preUpdate();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -36239,6 +36241,7 @@ Phaser.Sprite.prototype.preUpdate = function() {
|
|||
|
||||
/**
|
||||
* Override and use this function in your own custom objects to handle any update requirements you may have.
|
||||
* Remember if this Sprite has any children you should call update on them too.
|
||||
*
|
||||
* @method Phaser.Sprite#update
|
||||
* @memberof Phaser.Sprite
|
||||
|
@ -36275,6 +36278,12 @@ Phaser.Sprite.prototype.postUpdate = function() {
|
|||
this.position.y = this.game.camera.view.y + this.cameraOffset.y;
|
||||
}
|
||||
|
||||
// Update any Children
|
||||
for (var i = 0, len = this.children.length; i < len; i++)
|
||||
{
|
||||
this.children[i].postUpdate();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -37110,7 +37119,7 @@ Phaser.Image.prototype.preUpdate = function() {
|
|||
|
||||
if (!this.exists || !this.parent.exists)
|
||||
{
|
||||
this.renderOrderID = -1;
|
||||
this._cache[3] = -1;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -37124,7 +37133,13 @@ Phaser.Image.prototype.preUpdate = function() {
|
|||
|
||||
if (this.visible)
|
||||
{
|
||||
this._cache[3] = this.game.world.currentRenderOrderID++;
|
||||
this._cache[3] = this.game.stage.currentRenderOrderID++;
|
||||
}
|
||||
|
||||
// Update any Children
|
||||
for (var i = 0, len = this.children.length; i < len; i++)
|
||||
{
|
||||
this.children[i].preUpdate();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -37161,6 +37176,12 @@ Phaser.Image.prototype.postUpdate = function() {
|
|||
this.position.y = this.game.camera.view.y + this.cameraOffset.y;
|
||||
}
|
||||
|
||||
// Update any Children
|
||||
for (var i = 0, len = this.children.length; i < len; i++)
|
||||
{
|
||||
this.children[i].postUpdate();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -37873,6 +37894,17 @@ Phaser.TileSprite.prototype.preUpdate = function() {
|
|||
this.tilePosition.y += this._scroll.y * this.game.time.physicsElapsed;
|
||||
}
|
||||
|
||||
if (this.visible)
|
||||
{
|
||||
this._cache[3] = this.game.stage.currentRenderOrderID++;
|
||||
}
|
||||
|
||||
// Update any Children
|
||||
for (var i = 0, len = this.children.length; i < len; i++)
|
||||
{
|
||||
this.children[i].preUpdate();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
@ -37902,6 +37934,12 @@ Phaser.TileSprite.prototype.postUpdate = function() {
|
|||
this.position.y = this.game.camera.view.y + this.cameraOffset.y;
|
||||
}
|
||||
|
||||
// Update any Children
|
||||
for (var i = 0, len = this.children.length; i < len; i++)
|
||||
{
|
||||
this.children[i].postUpdate();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -38365,7 +38403,13 @@ Phaser.Text.prototype.preUpdate = function () {
|
|||
|
||||
if (this.visible)
|
||||
{
|
||||
this._cache[3] = this.game.world.currentRenderOrderID++;
|
||||
this._cache[3] = this.game.stage.currentRenderOrderID++;
|
||||
}
|
||||
|
||||
// Update any Children
|
||||
for (var i = 0, len = this.children.length; i < len; i++)
|
||||
{
|
||||
this.children[i].preUpdate();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -38394,6 +38438,12 @@ Phaser.Text.prototype.postUpdate = function () {
|
|||
this.position.y = this.game.camera.view.y + this.cameraOffset.y;
|
||||
}
|
||||
|
||||
// Update any Children
|
||||
for (var i = 0, len = this.children.length; i < len; i++)
|
||||
{
|
||||
this.children[i].postUpdate();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -39225,7 +39275,7 @@ Phaser.BitmapText.prototype.preUpdate = function () {
|
|||
|
||||
if (this.visible)
|
||||
{
|
||||
this._cache[3] = this.game.world.currentRenderOrderID++;
|
||||
this._cache[3] = this.game.stage.currentRenderOrderID++;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -40255,7 +40305,7 @@ Phaser.Graphics.prototype.preUpdate = function () {
|
|||
|
||||
if (this.visible)
|
||||
{
|
||||
this._cache[3] = this.game.world.currentRenderOrderID++;
|
||||
this._cache[3] = this.game.stage.currentRenderOrderID++;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
File diff suppressed because one or more lines are too long
18
build/phaser.min.js
vendored
18
build/phaser.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -55,6 +55,11 @@ Phaser.Stage = function (game, width, height) {
|
|||
*/
|
||||
this.exists = true;
|
||||
|
||||
/**
|
||||
* @property {number} currentRenderOrderID - Reset each frame, keeps a count of the total number of objects updated.
|
||||
*/
|
||||
this.currentRenderOrderID = 0;
|
||||
|
||||
/**
|
||||
* @property {string} hiddenVar - The page visibility API event name.
|
||||
* @private
|
||||
|
@ -98,9 +103,10 @@ Phaser.Stage.prototype.preUpdate = function () {
|
|||
|
||||
this.currentRenderOrderID = 0;
|
||||
|
||||
var i = this.children.length;
|
||||
// This can't loop in reverse, we need the orderID to be in sequence
|
||||
var len = this.children.length;
|
||||
|
||||
while (i--)
|
||||
for (var i = 0; i < len; i++)
|
||||
{
|
||||
this.children[i].preUpdate();
|
||||
}
|
||||
|
|
|
@ -33,11 +33,6 @@ Phaser.World = function (game) {
|
|||
* @property {Phaser.Camera} camera - Camera instance.
|
||||
*/
|
||||
this.camera = null;
|
||||
|
||||
/**
|
||||
* @property {number} currentRenderOrderID - Reset each frame, keeps a count of the total number of objects updated.
|
||||
*/
|
||||
this.currentRenderOrderID = 0;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -167,7 +167,7 @@ Phaser.BitmapText.prototype.preUpdate = function () {
|
|||
|
||||
if (this.visible)
|
||||
{
|
||||
this._cache[3] = this.game.world.currentRenderOrderID++;
|
||||
this._cache[3] = this.game.stage.currentRenderOrderID++;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -102,7 +102,7 @@ Phaser.Graphics.prototype.preUpdate = function () {
|
|||
|
||||
if (this.visible)
|
||||
{
|
||||
this._cache[3] = this.game.world.currentRenderOrderID++;
|
||||
this._cache[3] = this.game.stage.currentRenderOrderID++;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -134,7 +134,7 @@ Phaser.Image.prototype.preUpdate = function() {
|
|||
|
||||
if (!this.exists || !this.parent.exists)
|
||||
{
|
||||
this.renderOrderID = -1;
|
||||
this._cache[3] = -1;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -148,7 +148,13 @@ Phaser.Image.prototype.preUpdate = function() {
|
|||
|
||||
if (this.visible)
|
||||
{
|
||||
this._cache[3] = this.game.world.currentRenderOrderID++;
|
||||
this._cache[3] = this.game.stage.currentRenderOrderID++;
|
||||
}
|
||||
|
||||
// Update any Children
|
||||
for (var i = 0, len = this.children.length; i < len; i++)
|
||||
{
|
||||
this.children[i].preUpdate();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -185,6 +191,12 @@ Phaser.Image.prototype.postUpdate = function() {
|
|||
this.position.y = this.game.camera.view.y + this.cameraOffset.y;
|
||||
}
|
||||
|
||||
// Update any Children
|
||||
for (var i = 0, len = this.children.length; i < len; i++)
|
||||
{
|
||||
this.children[i].postUpdate();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -257,14 +257,15 @@ Phaser.Sprite.prototype.preUpdate = function() {
|
|||
|
||||
if (this.visible)
|
||||
{
|
||||
this._cache[3] = this.game.world.currentRenderOrderID++;
|
||||
this._cache[3] = this.game.stage.currentRenderOrderID++;
|
||||
}
|
||||
|
||||
this.animations.update();
|
||||
|
||||
if (this.body)
|
||||
// Update any Children
|
||||
for (var i = 0, len = this.children.length; i < len; i++)
|
||||
{
|
||||
// this.body.preUpdate();
|
||||
this.children[i].preUpdate();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -273,6 +274,7 @@ Phaser.Sprite.prototype.preUpdate = function() {
|
|||
|
||||
/**
|
||||
* Override and use this function in your own custom objects to handle any update requirements you may have.
|
||||
* Remember if this Sprite has any children you should call update on them too.
|
||||
*
|
||||
* @method Phaser.Sprite#update
|
||||
* @memberof Phaser.Sprite
|
||||
|
@ -309,6 +311,12 @@ Phaser.Sprite.prototype.postUpdate = function() {
|
|||
this.position.y = this.game.camera.view.y + this.cameraOffset.y;
|
||||
}
|
||||
|
||||
// Update any Children
|
||||
for (var i = 0, len = this.children.length; i < len; i++)
|
||||
{
|
||||
this.children[i].postUpdate();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -148,7 +148,13 @@ Phaser.Text.prototype.preUpdate = function () {
|
|||
|
||||
if (this.visible)
|
||||
{
|
||||
this._cache[3] = this.game.world.currentRenderOrderID++;
|
||||
this._cache[3] = this.game.stage.currentRenderOrderID++;
|
||||
}
|
||||
|
||||
// Update any Children
|
||||
for (var i = 0, len = this.children.length; i < len; i++)
|
||||
{
|
||||
this.children[i].preUpdate();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -177,6 +183,12 @@ Phaser.Text.prototype.postUpdate = function () {
|
|||
this.position.y = this.game.camera.view.y + this.cameraOffset.y;
|
||||
}
|
||||
|
||||
// Update any Children
|
||||
for (var i = 0, len = this.children.length; i < len; i++)
|
||||
{
|
||||
this.children[i].postUpdate();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -140,6 +140,17 @@ Phaser.TileSprite.prototype.preUpdate = function() {
|
|||
this.tilePosition.y += this._scroll.y * this.game.time.physicsElapsed;
|
||||
}
|
||||
|
||||
if (this.visible)
|
||||
{
|
||||
this._cache[3] = this.game.stage.currentRenderOrderID++;
|
||||
}
|
||||
|
||||
// Update any Children
|
||||
for (var i = 0, len = this.children.length; i < len; i++)
|
||||
{
|
||||
this.children[i].preUpdate();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
@ -169,6 +180,12 @@ Phaser.TileSprite.prototype.postUpdate = function() {
|
|||
this.position.y = this.game.camera.view.y + this.cameraOffset.y;
|
||||
}
|
||||
|
||||
// Update any Children
|
||||
for (var i = 0, len = this.children.length; i < len; i++)
|
||||
{
|
||||
this.children[i].postUpdate();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -355,7 +355,7 @@ Phaser.Pointer.prototype = {
|
|||
}
|
||||
|
||||
// Work out which object is on the top
|
||||
this._highestRenderOrderID = -1;
|
||||
this._highestRenderOrderID = Number.MAX_SAFE_INTEGER;
|
||||
this._highestRenderObject = null;
|
||||
this._highestInputPriorityID = -1;
|
||||
|
||||
|
@ -367,11 +367,11 @@ Phaser.Pointer.prototype = {
|
|||
do
|
||||
{
|
||||
// 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
|
||||
if (currentNode.pixelPerfectClick || currentNode.pixelPerfectOver || currentNode.priorityID > this._highestInputPriorityID || (currentNode.priorityID === this._highestInputPriorityID && currentNode.sprite.renderOrderID > this._highestRenderOrderID))
|
||||
if (currentNode.pixelPerfectClick || currentNode.pixelPerfectOver || currentNode.priorityID > this._highestInputPriorityID || (currentNode.priorityID === this._highestInputPriorityID && currentNode.sprite._cache[3] < this._highestRenderOrderID))
|
||||
{
|
||||
if ((!fromClick && currentNode.checkPointerOver(this)) || (fromClick && currentNode.checkPointerDown(this)))
|
||||
{
|
||||
this._highestRenderOrderID = currentNode.sprite.renderOrderID;
|
||||
this._highestRenderOrderID = currentNode.sprite._cache[3]; // renderOrderID
|
||||
this._highestInputPriorityID = currentNode.priorityID;
|
||||
this._highestRenderObject = currentNode;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue