Skip to content

Commit 0c4de35

Browse files
committed
The Input Manager has gained a new private property _tempMatrix2. This is used internally in the hitTest checks to avoid constant matrix creation.
1 parent 3469ff2 commit 0c4de35

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

src/input/InputManager.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,16 @@ var InputManager = new Class({
336336
*/
337337
this._tempMatrix = new TransformMatrix();
338338

339+
/**
340+
* A re-cycled matrix used in hit test calculations.
341+
*
342+
* @name Phaser.Input.InputManager#_tempMatrix2
343+
* @type {Phaser.GameObjects.Components.TransformMatrix}
344+
* @private
345+
* @since 3.12.0
346+
*/
347+
this._tempMatrix2 = new TransformMatrix();
348+
339349
game.events.once('boot', this.boot, this);
340350
},
341351

@@ -1136,6 +1146,7 @@ var InputManager = new Class({
11361146
var point = { x: 0, y: 0 };
11371147

11381148
var matrix = this._tempMatrix;
1149+
var parentMatrix = this._tempMatrix2;
11391150

11401151
for (var i = 0; i < gameObjects.length; i++)
11411152
{
@@ -1153,9 +1164,9 @@ var InputManager = new Class({
11531164

11541165
if (gameObject.parentContainer)
11551166
{
1156-
gameObject.getWorldTransformMatrix(matrix);
1167+
gameObject.getWorldTransformMatrix(matrix, parentMatrix);
11571168

1158-
TransformXY(px, py, matrix.tx, matrix.ty, matrix.rotation, matrix.scaleX, matrix.scaleY, point);
1169+
matrix.applyInverse(px, py, point);
11591170
}
11601171
else
11611172
{

0 commit comments

Comments
 (0)