Protect against NaN rotation values
Throws an Error if a DisplayObject's rotation was set to NaN. Without this check, Sprite's textures could disappear silently, with no reference to the improper rotation value as the culprit.
This commit is contained in:
parent
9509f43163
commit
53ccc8128b
1 changed files with 4 additions and 1 deletions
|
@ -402,6 +402,9 @@ PIXI.DisplayObject.prototype.updateTransform = function()
|
||||||
// TODO OPTIMIZE THIS!! with dirty
|
// TODO OPTIMIZE THIS!! with dirty
|
||||||
if(this.rotation !== this.rotationCache)
|
if(this.rotation !== this.rotationCache)
|
||||||
{
|
{
|
||||||
|
if(isNaN(parseFloat(this.rotation)))
|
||||||
|
throw new Error('DisplayObject rotation values must be numeric.');
|
||||||
|
|
||||||
this.rotationCache = this.rotation;
|
this.rotationCache = this.rotation;
|
||||||
this._sr = Math.sin(this.rotation);
|
this._sr = Math.sin(this.rotation);
|
||||||
this._cr = Math.cos(this.rotation);
|
this._cr = Math.cos(this.rotation);
|
||||||
|
@ -534,4 +537,4 @@ Object.defineProperty(PIXI.DisplayObject.prototype, 'y', {
|
||||||
set: function(value) {
|
set: function(value) {
|
||||||
this.position.y = value;
|
this.position.y = value;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue