Fixed bug with interaction when setting internal stage reference

This commit is contained in:
Mat Groves 2014-01-06 12:00:17 +00:00
parent e7205ad115
commit 0f6bf01788
3 changed files with 15 additions and 9 deletions

View file

@ -4,7 +4,7 @@
* Copyright (c) 2012, Mat Groves
* http://goodboydigital.com/
*
* Compiled: 2014-01-05
* Compiled: 2014-01-06
*
* pixi.js is licensed under the MIT License.
* http://www.opensource.org/licenses/mit-license.php
@ -1342,7 +1342,7 @@ PIXI.DisplayObjectContainer.prototype.removeChild = function(child)
if ( index !== -1 )
{
// update the stage reference..
if(this.stage)this.removeStageReference();
if(this.stage)child.removeStageReference();
child.parent = undefined;
this.children.splice( index, 1 );
@ -1424,24 +1424,27 @@ PIXI.DisplayObjectContainer.prototype.getBounds = function()
PIXI.DisplayObjectContainer.prototype.setStageReference = function(stage)
{
this.stage = stage;
if(this.interactive)this.stage.dirty = true;
for(var i=0,j=this.children.length; i<j; i++)
{
var child = this.children[i];
if(child.interactive)this.stage.dirty = true;
child.setStageReference(stage);
}
};
PIXI.DisplayObjectContainer.prototype.removeStageReference = function()
{
for(var i=0,j=this.children.length; i<j; i++)
{
var child = this.children[i];
if(child.interactive)this.stage.dirty = true;
child.removeStageReference();
}
if(this.interactive)this.stage.dirty = true;
this.stage = null;
};

File diff suppressed because one or more lines are too long

View file

@ -176,7 +176,7 @@ PIXI.DisplayObjectContainer.prototype.removeChild = function(child)
if ( index !== -1 )
{
// update the stage reference..
if(this.stage)this.removeStageReference();
if(this.stage)child.removeStageReference();
child.parent = undefined;
this.children.splice( index, 1 );
@ -258,24 +258,27 @@ PIXI.DisplayObjectContainer.prototype.getBounds = function()
PIXI.DisplayObjectContainer.prototype.setStageReference = function(stage)
{
this.stage = stage;
if(this.interactive)this.stage.dirty = true;
for(var i=0,j=this.children.length; i<j; i++)
{
var child = this.children[i];
if(child.interactive)this.stage.dirty = true;
child.setStageReference(stage);
}
};
PIXI.DisplayObjectContainer.prototype.removeStageReference = function()
{
for(var i=0,j=this.children.length; i<j; i++)
{
var child = this.children[i];
if(child.interactive)this.stage.dirty = true;
child.removeStageReference();
}
if(this.interactive)this.stage.dirty = true;
this.stage = null;
};