Fixed major issue with removeChild

This commit is contained in:
Mat Groves 2014-01-15 13:13:13 +00:00
parent 73aa9dca93
commit 3d93fa8f0a
4 changed files with 5 additions and 6 deletions

View file

@ -1243,17 +1243,18 @@ Object.defineProperty(PIXI.DisplayObjectContainer.prototype, 'height', {
*/ */
PIXI.DisplayObjectContainer.prototype.addChild = function(child) PIXI.DisplayObjectContainer.prototype.addChild = function(child)
{ {
if(child.parent && child.parent !== this) if(child.parent && child !== this)
{ {
//// COULD BE THIS??? //// COULD BE THIS???
child.parent.removeChild(child); child.parent.removeChild(child);
// return; // return;
} }
// console.log("ADDING")
child.parent = this; child.parent = this;
this.children.push(child); this.children.push(child);
// console.log( this.children.length);
// update the stage refference.. // update the stage refference..
if(this.stage)child.setStageReference(this.stage); if(this.stage)child.setStageReference(this.stage);
@ -7426,7 +7427,6 @@ PIXI.Graphics.prototype._renderWebGL = function(renderSession)
} }
renderSession.spriteBatch.stop(); renderSession.spriteBatch.stop();
} }
if(this._filters)renderSession.filterManager.popFilter(); if(this._filters)renderSession.filterManager.popFilter();

File diff suppressed because one or more lines are too long

View file

@ -75,7 +75,7 @@ Object.defineProperty(PIXI.DisplayObjectContainer.prototype, 'height', {
*/ */
PIXI.DisplayObjectContainer.prototype.addChild = function(child) PIXI.DisplayObjectContainer.prototype.addChild = function(child)
{ {
if(child.parent && child.parent !== this) if(child.parent && child !== this)
{ {
//// COULD BE THIS??? //// COULD BE THIS???
child.parent.removeChild(child); child.parent.removeChild(child);

View file

@ -343,7 +343,6 @@ PIXI.Graphics.prototype._renderWebGL = function(renderSession)
} }
renderSession.spriteBatch.stop(); renderSession.spriteBatch.stop();
} }
if(this._filters)renderSession.filterManager.popFilter(); if(this._filters)renderSession.filterManager.popFilter();