Don't create the temp parentMatrix if all we're doing is making a local matrix

This commit is contained in:
Richard Davey 2023-01-17 22:59:55 +00:00
parent f7f70ac63b
commit bfb3008efe

View file

@ -512,7 +512,6 @@ var Transform = {
getWorldTransformMatrix: function (tempMatrix, parentMatrix) getWorldTransformMatrix: function (tempMatrix, parentMatrix)
{ {
if (tempMatrix === undefined) { tempMatrix = new TransformMatrix(); } if (tempMatrix === undefined) { tempMatrix = new TransformMatrix(); }
if (parentMatrix === undefined) { parentMatrix = new TransformMatrix(); }
var parent = this.parentContainer; var parent = this.parentContainer;
@ -521,6 +520,11 @@ var Transform = {
return this.getLocalTransformMatrix(tempMatrix); return this.getLocalTransformMatrix(tempMatrix);
} }
if (!parentMatrix)
{
parentMatrix = new TransformMatrix();
}
tempMatrix.applyITRS(this.x, this.y, this._rotation, this._scaleX, this._scaleY); tempMatrix.applyITRS(this.x, this.y, this._rotation, this._scaleX, this._scaleY);
while (parent) while (parent)