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

View file

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

View file

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