Fixed left / right rotation and exposed via namespace

Phaser.Utils.Array.Matrix.RotateLeft actually rotated to the right (thanks @Tomas2h)
Phaser.Utils.Array.Matrix.RotateRight actually rotated to the left (thanks @Tomas2h)
This commit is contained in:
Richard Davey 2018-03-17 17:03:15 +00:00
parent 2ea8489716
commit 46e9dbd05a
5 changed files with 9 additions and 5 deletions

View file

@ -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

View file

@ -12,6 +12,7 @@ module.exports = {
FindClosestInSorted: require('./FindClosestInSorted'),
GetRandomElement: require('./GetRandomElement'),
Matrix: require('./Matrix'),
NumberArray: require('./NumberArray'),
NumberArrayStep: require('./NumberArrayStep'),
QuickSelect: require('./QuickSelect'),

View file

@ -18,7 +18,7 @@ var RotateMatrix = require('./RotateMatrix');
*/
var RotateLeft = function (matrix)
{
return RotateMatrix(matrix, -90);
return RotateMatrix(matrix, 90);
};
module.exports = RotateLeft;

View file

@ -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;

View file

@ -18,7 +18,7 @@ var RotateMatrix = require('./RotateMatrix');
*/
var RotateRight = function (matrix)
{
return RotateMatrix(matrix, 90);
return RotateMatrix(matrix, -90);
};
module.exports = RotateRight;