diff --git a/src/core/display/DisplayObject.js b/src/core/display/DisplayObject.js index 0411e79..9830912 100644 --- a/src/core/display/DisplayObject.js +++ b/src/core/display/DisplayObject.js @@ -175,6 +175,7 @@ /** * The coordinate of the object relative to the local coordinates of the parent. + * Assignment by value since pixi-v4. * * @member {PIXI.Point|PIXI.ObservablePoint} * @memberof PIXI.DisplayObject# @@ -185,12 +186,13 @@ return this.transform.position; }, set: function(value) { - this.transform.position = value; + this.transform.position.copy(value); } }, /** * The scale factor of the object. + * Assignment by value since pixi-v4. * * @member {PIXI.Point|PIXI.ObservablePoint} * @memberof PIXI.DisplayObject# @@ -200,12 +202,13 @@ return this.transform.scale; }, set: function(value) { - this.transform.scale = value; + this.transform.scale.copy(value); } }, /** * The pivot point of the displayObject that it rotates around + * Assignment by value since pixi-v4. * * @member {PIXI.Point|PIXI.ObservablePoint} * @memberof PIXI.DisplayObject# @@ -215,12 +218,13 @@ return this.transform.pivot; }, set: function(value) { - this.transform.pivot = value; + this.transform.pivot.copy(value); } }, /** * The skew factor for the object in radians. + * Assignment by value since pixi-v4. * * @member {PIXI.ObservablePoint} * @memberof PIXI.DisplayObject# @@ -230,7 +234,7 @@ return this.transform.skew; }, set: function(value) { - this.transform.skew = value; + this.transform.skew.copy(value); } }, @@ -497,11 +501,7 @@ */ DisplayObject.prototype.destroy = function () { - - this.position = null; - this.scale = null; - this.pivot = null; - this.skew = null; + this.transform = null; this.parent = null; diff --git a/src/core/display/DisplayObject.js b/src/core/display/DisplayObject.js index 0411e79..9830912 100644 --- a/src/core/display/DisplayObject.js +++ b/src/core/display/DisplayObject.js @@ -175,6 +175,7 @@ /** * The coordinate of the object relative to the local coordinates of the parent. + * Assignment by value since pixi-v4. * * @member {PIXI.Point|PIXI.ObservablePoint} * @memberof PIXI.DisplayObject# @@ -185,12 +186,13 @@ return this.transform.position; }, set: function(value) { - this.transform.position = value; + this.transform.position.copy(value); } }, /** * The scale factor of the object. + * Assignment by value since pixi-v4. * * @member {PIXI.Point|PIXI.ObservablePoint} * @memberof PIXI.DisplayObject# @@ -200,12 +202,13 @@ return this.transform.scale; }, set: function(value) { - this.transform.scale = value; + this.transform.scale.copy(value); } }, /** * The pivot point of the displayObject that it rotates around + * Assignment by value since pixi-v4. * * @member {PIXI.Point|PIXI.ObservablePoint} * @memberof PIXI.DisplayObject# @@ -215,12 +218,13 @@ return this.transform.pivot; }, set: function(value) { - this.transform.pivot = value; + this.transform.pivot.copy(value); } }, /** * The skew factor for the object in radians. + * Assignment by value since pixi-v4. * * @member {PIXI.ObservablePoint} * @memberof PIXI.DisplayObject# @@ -230,7 +234,7 @@ return this.transform.skew; }, set: function(value) { - this.transform.skew = value; + this.transform.skew.copy(value); } }, @@ -497,11 +501,7 @@ */ DisplayObject.prototype.destroy = function () { - - this.position = null; - this.scale = null; - this.pivot = null; - this.skew = null; + this.transform = null; this.parent = null; diff --git a/test/unit/core/display/Container.test.js b/test/unit/core/display/Container.test.js index 026848e..668cbed 100644 --- a/test/unit/core/display/Container.test.js +++ b/test/unit/core/display/Container.test.js @@ -44,9 +44,9 @@ it('should call through to DisplayContainer.destroy', function () { var container = new PIXI.Container(); - expect(container.position).to.not.equal(null); + expect(container.transform).to.not.equal(null); container.destroy(); - expect(container.position).to.equal(null); + expect(container.transform).to.equal(null); }); it('should set children to null', function () { @@ -63,8 +63,8 @@ container.addChild(child); container.destroy(); - expect(container.position).to.equal(null); - expect(child.position).to.not.equal(null); + expect(container.transform).to.equal(null); + expect(child.transform).to.not.equal(null); }); it('should destroy children if children flag is set', function () { @@ -73,8 +73,8 @@ container.addChild(child); container.destroy({children: true}); - expect(container.position).to.equal(null); - expect(child.position).to.equal(null); + expect(container.transform).to.equal(null); + expect(child.transform).to.equal(null); }); it('should pass opts on to children if children flag is set', function () { diff --git a/src/core/display/DisplayObject.js b/src/core/display/DisplayObject.js index 0411e79..9830912 100644 --- a/src/core/display/DisplayObject.js +++ b/src/core/display/DisplayObject.js @@ -175,6 +175,7 @@ /** * The coordinate of the object relative to the local coordinates of the parent. + * Assignment by value since pixi-v4. * * @member {PIXI.Point|PIXI.ObservablePoint} * @memberof PIXI.DisplayObject# @@ -185,12 +186,13 @@ return this.transform.position; }, set: function(value) { - this.transform.position = value; + this.transform.position.copy(value); } }, /** * The scale factor of the object. + * Assignment by value since pixi-v4. * * @member {PIXI.Point|PIXI.ObservablePoint} * @memberof PIXI.DisplayObject# @@ -200,12 +202,13 @@ return this.transform.scale; }, set: function(value) { - this.transform.scale = value; + this.transform.scale.copy(value); } }, /** * The pivot point of the displayObject that it rotates around + * Assignment by value since pixi-v4. * * @member {PIXI.Point|PIXI.ObservablePoint} * @memberof PIXI.DisplayObject# @@ -215,12 +218,13 @@ return this.transform.pivot; }, set: function(value) { - this.transform.pivot = value; + this.transform.pivot.copy(value); } }, /** * The skew factor for the object in radians. + * Assignment by value since pixi-v4. * * @member {PIXI.ObservablePoint} * @memberof PIXI.DisplayObject# @@ -230,7 +234,7 @@ return this.transform.skew; }, set: function(value) { - this.transform.skew = value; + this.transform.skew.copy(value); } }, @@ -497,11 +501,7 @@ */ DisplayObject.prototype.destroy = function () { - - this.position = null; - this.scale = null; - this.pivot = null; - this.skew = null; + this.transform = null; this.parent = null; diff --git a/test/unit/core/display/Container.test.js b/test/unit/core/display/Container.test.js index 026848e..668cbed 100644 --- a/test/unit/core/display/Container.test.js +++ b/test/unit/core/display/Container.test.js @@ -44,9 +44,9 @@ it('should call through to DisplayContainer.destroy', function () { var container = new PIXI.Container(); - expect(container.position).to.not.equal(null); + expect(container.transform).to.not.equal(null); container.destroy(); - expect(container.position).to.equal(null); + expect(container.transform).to.equal(null); }); it('should set children to null', function () { @@ -63,8 +63,8 @@ container.addChild(child); container.destroy(); - expect(container.position).to.equal(null); - expect(child.position).to.not.equal(null); + expect(container.transform).to.equal(null); + expect(child.transform).to.not.equal(null); }); it('should destroy children if children flag is set', function () { @@ -73,8 +73,8 @@ container.addChild(child); container.destroy({children: true}); - expect(container.position).to.equal(null); - expect(child.position).to.equal(null); + expect(container.transform).to.equal(null); + expect(child.transform).to.equal(null); }); it('should pass opts on to children if children flag is set', function () { diff --git a/test/unit/core/text/Text.test.js b/test/unit/core/text/Text.test.js index eecf9a0..4564c06 100644 --- a/test/unit/core/text/Text.test.js +++ b/test/unit/core/text/Text.test.js @@ -22,8 +22,8 @@ text.addChild(child); text.destroy({children: true}); - expect(text.position).to.equal(null); - expect(child.position).to.equal(null); + expect(text.transform).to.equal(null); + expect(child.transform).to.equal(null); }); it('should accept boolean correctly', function () { @@ -32,8 +32,8 @@ text.addChild(child); text.destroy(true); - expect(text.position).to.equal(null); - expect(child.position).to.equal(null); + expect(text.transform).to.equal(null); + expect(child.transform).to.equal(null); }); it('should pass opts on to children if children flag is set', function () {