diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a1de765b..fe1aeb44e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -47,6 +47,7 @@ * The Phaser.Physics.Arcade constants are now exposed on the namespace. Fix #3387 (thanks @samme) * The Phaser.Scene constants are now exposed on the namespace. Fix #3387 (thanks @samme) * The Phaser.Tweens constants are now exposed on the namespace. Fix #3387 (thanks @samme) +* The Array Matrix utils are now exposed and available via `Phaser.Utils.Array.Matrix`. @@ -67,6 +68,8 @@ * TileSprite scaling differed between WebGL and Canvas. Fix #3338 (thanks @TCatshoek) * Text.setFixedSize was incorrectly setting the `text` property instead of the `parent` property. Fix #3375 (thanks @rexrainbow) * RenderTexture.clear on canvas was using the last transform state, instead of clearing the whole texture. +* Phaser.Utils.Array.Matrix.RotateLeft actually rotated to the right (thanks @Tomas2h) +* Phaser.Utils.Array.Matrix.RotateRight actually rotated to the left (thanks @Tomas2h) ### Updates diff --git a/src/utils/array/index.js b/src/utils/array/index.js index ad9bba586..b51f46c3b 100644 --- a/src/utils/array/index.js +++ b/src/utils/array/index.js @@ -12,6 +12,7 @@ module.exports = { FindClosestInSorted: require('./FindClosestInSorted'), GetRandomElement: require('./GetRandomElement'), + Matrix: require('./Matrix'), NumberArray: require('./NumberArray'), NumberArrayStep: require('./NumberArrayStep'), QuickSelect: require('./QuickSelect'), diff --git a/src/utils/array/matrix/RotateLeft.js b/src/utils/array/matrix/RotateLeft.js index 92dac0edc..cf23066bd 100644 --- a/src/utils/array/matrix/RotateLeft.js +++ b/src/utils/array/matrix/RotateLeft.js @@ -18,7 +18,7 @@ var RotateMatrix = require('./RotateMatrix'); */ var RotateLeft = function (matrix) { - return RotateMatrix(matrix, -90); + return RotateMatrix(matrix, 90); }; module.exports = RotateLeft; diff --git a/src/utils/array/matrix/RotateMatrix.js b/src/utils/array/matrix/RotateMatrix.js index db26004eb..ea5e098a7 100644 --- a/src/utils/array/matrix/RotateMatrix.js +++ b/src/utils/array/matrix/RotateMatrix.js @@ -37,11 +37,11 @@ var RotateMatrix = function (matrix, direction) if (direction === 90 || direction === -270 || direction === 'rotateLeft') { matrix = TransposeMatrix(matrix); - matrix = matrix.reverse(); + matrix.reverse(); } else if (direction === -90 || direction === 270 || direction === 'rotateRight') { - matrix = matrix.reverse(); + matrix.reverse(); matrix = TransposeMatrix(matrix); } else if (Math.abs(direction) === 180 || direction === 'rotate180') @@ -51,7 +51,7 @@ var RotateMatrix = function (matrix, direction) matrix[i].reverse(); } - matrix = matrix.reverse(); + matrix.reverse(); } return matrix; diff --git a/src/utils/array/matrix/RotateRight.js b/src/utils/array/matrix/RotateRight.js index f7889cc8a..c4be6a1cf 100644 --- a/src/utils/array/matrix/RotateRight.js +++ b/src/utils/array/matrix/RotateRight.js @@ -18,7 +18,7 @@ var RotateMatrix = require('./RotateMatrix'); */ var RotateRight = function (matrix) { - return RotateMatrix(matrix, 90); + return RotateMatrix(matrix, -90); }; module.exports = RotateRight;