Fixed issue with setStageRefference and worldVisible function

This commit is contained in:
Mat Groves 2014-01-07 14:55:33 +00:00
parent e0dc3158c1
commit 4d0eb366a1
5 changed files with 16 additions and 18 deletions

View file

@ -4,7 +4,7 @@
* Copyright (c) 2012, Mat Groves
* http://goodboydigital.com/
*
* Compiled: 2014-01-06
* Compiled: 2014-01-07
*
* pixi.js is licensed under the MIT License.
* http://www.opensource.org/licenses/mit-license.php
@ -1010,7 +1010,7 @@ Object.defineProperty(PIXI.DisplayObject.prototype, 'worldVisible', {
if(!item.visible)return false;
item = item.parent;
}
while(item && item.parent);
while(item);
return true;
}
@ -1254,7 +1254,7 @@ PIXI.DisplayObjectContainer.prototype.addChild = function(child)
// update the stage refference..
if(this.stage)this.setStageReference(this.stage);
if(this.stage)child.setStageReference(this.stage);
};
@ -1278,7 +1278,7 @@ PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
this.children.splice(index, 0, child);
if(this.stage)this.setStageReference(this.stage);
if(this.stage)child.setStageReference(this.stage);
}
else
{
@ -1424,12 +1424,11 @@ PIXI.DisplayObjectContainer.prototype.getBounds = function()
PIXI.DisplayObjectContainer.prototype.setStageReference = function(stage)
{
this.stage = stage;
if(this.interactive)this.stage.dirty = true;
if(this._interactive)this.stage.dirty = true;
for(var i=0,j=this.children.length; i<j; i++)
{
var child = this.children[i];
child.setStageReference(stage);
}
};
@ -1443,7 +1442,7 @@ PIXI.DisplayObjectContainer.prototype.removeStageReference = function()
child.removeStageReference();
}
if(this.interactive)this.stage.dirty = true;
if(this._interactive)this.stage.dirty = true;
this.stage = null;
};

File diff suppressed because one or more lines are too long

View file

@ -311,7 +311,7 @@ Object.defineProperty(PIXI.DisplayObject.prototype, 'worldVisible', {
if(!item.visible)return false;
item = item.parent;
}
while(item && item.parent);
while(item);
return true;
}

View file

@ -88,7 +88,7 @@ PIXI.DisplayObjectContainer.prototype.addChild = function(child)
// update the stage refference..
if(this.stage)this.setStageReference(this.stage);
if(this.stage)child.setStageReference(this.stage);
};
@ -112,7 +112,7 @@ PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
this.children.splice(index, 0, child);
if(this.stage)this.setStageReference(this.stage);
if(this.stage)child.setStageReference(this.stage);
}
else
{
@ -258,12 +258,11 @@ PIXI.DisplayObjectContainer.prototype.getBounds = function()
PIXI.DisplayObjectContainer.prototype.setStageReference = function(stage)
{
this.stage = stage;
if(this.interactive)this.stage.dirty = true;
if(this._interactive)this.stage.dirty = true;
for(var i=0,j=this.children.length; i<j; i++)
{
var child = this.children[i];
child.setStageReference(stage);
}
};
@ -277,7 +276,7 @@ PIXI.DisplayObjectContainer.prototype.removeStageReference = function()
child.removeStageReference();
}
if(this.interactive)this.stage.dirty = true;
if(this._interactive)this.stage.dirty = true;
this.stage = null;
};

View file

@ -19,7 +19,6 @@ describe('pixi/display/Stage', function () {
expect(obj).to.respondTo('updateTransform');
expect(obj).to.respondTo('setBackgroundColor');
expect(obj).to.respondTo('getMousePosition');
// FIXME: duplicate member in DisplayObject
pixi_core_Matrix_confirmNewMat3(obj.worldTransform);
// FIXME: convert arg to bool in constructor
@ -44,6 +43,7 @@ describe('pixi/display/Stage', function () {
expect(obj).to.have.deep.property('backgroundColorSplit[2]', 0);
expect(obj).to.have.property('backgroundColorString', '#000000');
expect(obj).to.have.property('worldVisible', true);
});
});