diff --git a/src/core/display/DisplayObject.js b/src/core/display/DisplayObject.js index 159bd52..018cec8 100644 --- a/src/core/display/DisplayObject.js +++ b/src/core/display/DisplayObject.js @@ -17,6 +17,10 @@ EventEmitter.call(this); //TODO: need to create Transform from factory + /** + * World transform and local transform of this object. + * This will be reworked in v4.1, please do not use it yet unless you know what are you doing! + */ this.transform = new Transform(); /** diff --git a/src/core/display/DisplayObject.js b/src/core/display/DisplayObject.js index 159bd52..018cec8 100644 --- a/src/core/display/DisplayObject.js +++ b/src/core/display/DisplayObject.js @@ -17,6 +17,10 @@ EventEmitter.call(this); //TODO: need to create Transform from factory + /** + * World transform and local transform of this object. + * This will be reworked in v4.1, please do not use it yet unless you know what are you doing! + */ this.transform = new Transform(); /** diff --git a/src/core/display/Transform.js b/src/core/display/Transform.js index 6c43820..764056d 100644 --- a/src/core/display/Transform.js +++ b/src/core/display/Transform.js @@ -4,6 +4,7 @@ /** * Generic class to deal with traditional 2D matrix transforms + * This will be reworked in v4.1, please do not use it yet unless you know what are you doing! * * @class * @memberof PIXI diff --git a/src/core/display/DisplayObject.js b/src/core/display/DisplayObject.js index 159bd52..018cec8 100644 --- a/src/core/display/DisplayObject.js +++ b/src/core/display/DisplayObject.js @@ -17,6 +17,10 @@ EventEmitter.call(this); //TODO: need to create Transform from factory + /** + * World transform and local transform of this object. + * This will be reworked in v4.1, please do not use it yet unless you know what are you doing! + */ this.transform = new Transform(); /** diff --git a/src/core/display/Transform.js b/src/core/display/Transform.js index 6c43820..764056d 100644 --- a/src/core/display/Transform.js +++ b/src/core/display/Transform.js @@ -4,6 +4,7 @@ /** * Generic class to deal with traditional 2D matrix transforms + * This will be reworked in v4.1, please do not use it yet unless you know what are you doing! * * @class * @memberof PIXI diff --git a/src/core/display/TransformStatic.js b/src/core/display/TransformStatic.js index d7c632d..bdfdfdc 100644 --- a/src/core/display/TransformStatic.js +++ b/src/core/display/TransformStatic.js @@ -1,10 +1,9 @@ var math = require('../math'); var ObservablePoint = require('./ObservablePoint'); -var generatorId = 0; /** - * The Point object represents a location in a two-dimensional coordinate system, where x represents - * the horizontal axis and y represents the vertical axis. + * Transform that takes care about its versions + * This will be reworked in v4.1, please do not use it yet unless you know what are you doing! * * @class * @memberof PIXI @@ -54,12 +53,9 @@ this._sr = Math.sin(0); this._cr = Math.cos(0); + this._dirtyLocal = 0; this._versionLocal = 0; this._versionGlobal = 0; - this._dirtyLocal = 0; - this._dirtyParentVersion = -1; - this._dirtyParentId = -1; - this._transformId = ++generatorId; } TransformStatic.prototype.constructor = TransformStatic; @@ -75,35 +71,27 @@ var wt = this.worldTransform; var lt = this.localTransform; - this.updated = false; - if(this._dirtyLocal !== this._versionLocal || - parentTransform._dirtyParentId !== parentTransform._transformId || - parentTransform._dirtyParentVersion !== parentTransform._versionGlobal ) + if(this._dirtyLocal !== this._versionLocal) { - if(this._dirtyLocal !== this._versionLocal) - { - // get the matrix values of the displayobject based on its transform properties.. - lt.a = this._cr * this.scale._x; - lt.b = this._sr * this.scale._x; - lt.c = -this._sr * this.scale._y; - lt.d = this._cr * this.scale._y; - lt.tx = this.position._x - (this.pivot._x * lt.a + this.pivot._y * lt.c); - lt.ty = this.position._y - (this.pivot._x * lt.b + this.pivot._y * lt.d); - this._dirtyLocal = this._versionLocal; - } - // concat the parent matrix with the objects transform. - wt.a = lt.a * pt.a + lt.b * pt.c; - wt.b = lt.a * pt.b + lt.b * pt.d; - wt.c = lt.c * pt.a + lt.d * pt.c; - wt.d = lt.c * pt.b + lt.d * pt.d; - wt.tx = lt.tx * pt.a + lt.ty * pt.c + pt.tx; - wt.ty = lt.tx * pt.b + lt.ty * pt.d + pt.ty; - - this._dirtyParentId = parentTransform._transformId; - this._dirtyParentVersion = parentTransform._versionGlobal; - this._versionGlobal++; - this.updated = true; + // get the matrix values of the displayobject based on its transform properties.. + lt.a = this._cr * this.scale._x; + lt.b = this._sr * this.scale._x; + lt.c = -this._sr * this.scale._y; + lt.d = this._cr * this.scale._y; + lt.tx = this.position._x - (this.pivot._x * lt.a + this.pivot._y * lt.c); + lt.ty = this.position._y - (this.pivot._x * lt.b + this.pivot._y * lt.d); + this._dirtyLocal = this._versionLocal; } + // concat the parent matrix with the objects transform. + wt.a = lt.a * pt.a + lt.b * pt.c; + wt.b = lt.a * pt.b + lt.b * pt.d; + wt.c = lt.c * pt.a + lt.d * pt.c; + wt.d = lt.c * pt.b + lt.d * pt.d; + wt.tx = lt.tx * pt.a + lt.ty * pt.c + pt.tx; + wt.ty = lt.tx * pt.b + lt.ty * pt.d + pt.ty; + + this._versionGlobal++; + this.updated = true; }; TransformStatic.prototype.updateChildTransform = function (childTransform) diff --git a/src/core/display/DisplayObject.js b/src/core/display/DisplayObject.js index 159bd52..018cec8 100644 --- a/src/core/display/DisplayObject.js +++ b/src/core/display/DisplayObject.js @@ -17,6 +17,10 @@ EventEmitter.call(this); //TODO: need to create Transform from factory + /** + * World transform and local transform of this object. + * This will be reworked in v4.1, please do not use it yet unless you know what are you doing! + */ this.transform = new Transform(); /** diff --git a/src/core/display/Transform.js b/src/core/display/Transform.js index 6c43820..764056d 100644 --- a/src/core/display/Transform.js +++ b/src/core/display/Transform.js @@ -4,6 +4,7 @@ /** * Generic class to deal with traditional 2D matrix transforms + * This will be reworked in v4.1, please do not use it yet unless you know what are you doing! * * @class * @memberof PIXI diff --git a/src/core/display/TransformStatic.js b/src/core/display/TransformStatic.js index d7c632d..bdfdfdc 100644 --- a/src/core/display/TransformStatic.js +++ b/src/core/display/TransformStatic.js @@ -1,10 +1,9 @@ var math = require('../math'); var ObservablePoint = require('./ObservablePoint'); -var generatorId = 0; /** - * The Point object represents a location in a two-dimensional coordinate system, where x represents - * the horizontal axis and y represents the vertical axis. + * Transform that takes care about its versions + * This will be reworked in v4.1, please do not use it yet unless you know what are you doing! * * @class * @memberof PIXI @@ -54,12 +53,9 @@ this._sr = Math.sin(0); this._cr = Math.cos(0); + this._dirtyLocal = 0; this._versionLocal = 0; this._versionGlobal = 0; - this._dirtyLocal = 0; - this._dirtyParentVersion = -1; - this._dirtyParentId = -1; - this._transformId = ++generatorId; } TransformStatic.prototype.constructor = TransformStatic; @@ -75,35 +71,27 @@ var wt = this.worldTransform; var lt = this.localTransform; - this.updated = false; - if(this._dirtyLocal !== this._versionLocal || - parentTransform._dirtyParentId !== parentTransform._transformId || - parentTransform._dirtyParentVersion !== parentTransform._versionGlobal ) + if(this._dirtyLocal !== this._versionLocal) { - if(this._dirtyLocal !== this._versionLocal) - { - // get the matrix values of the displayobject based on its transform properties.. - lt.a = this._cr * this.scale._x; - lt.b = this._sr * this.scale._x; - lt.c = -this._sr * this.scale._y; - lt.d = this._cr * this.scale._y; - lt.tx = this.position._x - (this.pivot._x * lt.a + this.pivot._y * lt.c); - lt.ty = this.position._y - (this.pivot._x * lt.b + this.pivot._y * lt.d); - this._dirtyLocal = this._versionLocal; - } - // concat the parent matrix with the objects transform. - wt.a = lt.a * pt.a + lt.b * pt.c; - wt.b = lt.a * pt.b + lt.b * pt.d; - wt.c = lt.c * pt.a + lt.d * pt.c; - wt.d = lt.c * pt.b + lt.d * pt.d; - wt.tx = lt.tx * pt.a + lt.ty * pt.c + pt.tx; - wt.ty = lt.tx * pt.b + lt.ty * pt.d + pt.ty; - - this._dirtyParentId = parentTransform._transformId; - this._dirtyParentVersion = parentTransform._versionGlobal; - this._versionGlobal++; - this.updated = true; + // get the matrix values of the displayobject based on its transform properties.. + lt.a = this._cr * this.scale._x; + lt.b = this._sr * this.scale._x; + lt.c = -this._sr * this.scale._y; + lt.d = this._cr * this.scale._y; + lt.tx = this.position._x - (this.pivot._x * lt.a + this.pivot._y * lt.c); + lt.ty = this.position._y - (this.pivot._x * lt.b + this.pivot._y * lt.d); + this._dirtyLocal = this._versionLocal; } + // concat the parent matrix with the objects transform. + wt.a = lt.a * pt.a + lt.b * pt.c; + wt.b = lt.a * pt.b + lt.b * pt.d; + wt.c = lt.c * pt.a + lt.d * pt.c; + wt.d = lt.c * pt.b + lt.d * pt.d; + wt.tx = lt.tx * pt.a + lt.ty * pt.c + pt.tx; + wt.ty = lt.tx * pt.b + lt.ty * pt.d + pt.ty; + + this._versionGlobal++; + this.updated = true; }; TransformStatic.prototype.updateChildTransform = function (childTransform) diff --git a/src/core/index.js b/src/core/index.js index 9bc82d3..8b36190 100644 --- a/src/core/index.js +++ b/src/core/index.js @@ -17,6 +17,8 @@ // display DisplayObject: require('./display/DisplayObject'), Container: require('./display/Container'), + Transform: require('./display/Transform'), + TransformStatic: require('./display/TransformStatic'), // sprites Sprite: require('./sprites/Sprite'),