Skip to content

Commit e0dc28e

Browse files
committed
Fixed lint errors and added jsdocs
1 parent 0e401bb commit e0dc28e

1 file changed

Lines changed: 25 additions & 5 deletions

File tree

src/gameobjects/components/Transform.js

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
var MATH_CONST = require('../../math/const');
88
var WrapAngle = require('../../math/angle/Wrap');
99
var WrapAngleDegrees = require('../../math/angle/WrapDegrees');
10-
var TransformMatrix = require('./TransformMatrix');
1110

1211
// global bitmask flag for GameObject.renderMask (used by Scale)
1312
var _FLAG = 4; // 0100
@@ -371,11 +370,31 @@ var Transform = {
371370
return this;
372371
},
373372

373+
/**
374+
* Gets the local transform matrix for this Game Object.
375+
*
376+
* @method Phaser.GameObjects.Components.Transform#getLocalTransformMatrix
377+
* @since 3.4.0
378+
*
379+
* @param {Phaser.GameObjects.Components.TransformMatrix} tempMatrix - The matrix to populate with the values from this Game Object.
380+
*
381+
* @return {Phaser.GameObjects.Components.TransformMatrix} The populated Transform Matrix.
382+
*/
374383
getLocalTransformMatrix: function (tempMatrix)
375384
{
376385
return tempMatrix.applyITRS(this.x, this.y, this._rotation, this._scaleX, this._scaleY);
377386
},
378387

388+
/**
389+
* Gets the world transform matrix for this Game Object, factoring in any parent Containers.
390+
*
391+
* @method Phaser.GameObjects.Components.Transform#getWorldTransformMatrix
392+
* @since 3.4.0
393+
*
394+
* @param {Phaser.GameObjects.Components.TransformMatrix} tempMatrix - The matrix to populate with the values from this Game Object.
395+
*
396+
* @return {Phaser.GameObjects.Components.TransformMatrix} The populated Transform Matrix.
397+
*/
379398
getWorldTransformMatrix: function (tempMatrix)
380399
{
381400
var parent = this.parentContainer;
@@ -393,10 +412,11 @@ var Transform = {
393412

394413
for (var i = 0; i < length; ++i)
395414
{
396-
rootContainer = parents[i];
397-
tempMatrix.translate(rootContainer.x, rootContainer.y);
398-
tempMatrix.rotate(rootContainer.rotation);
399-
tempMatrix.scale(rootContainer.scaleX, rootContainer.scaleY);
415+
parent = parents[i];
416+
417+
tempMatrix.translate(parent.x, parent.y);
418+
tempMatrix.rotate(parent._rotation);
419+
tempMatrix.scale(parent._scaleX, parent._scaleY);
400420
}
401421

402422
tempMatrix.translate(this.x, this.y);

0 commit comments

Comments
 (0)