Skip to content

Commit d941e28

Browse files
committed
Math/Utils - various cleanup and deprecations/moves
- And one last before..
1 parent a35d032 commit d941e28

2 files changed

Lines changed: 14 additions & 6 deletions

File tree

src/math/Math.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,22 @@
55
*/
66

77
/**
8-
* A collection of mathematical methods.
8+
* A collection of useful mathematical functions.
9+
*
10+
* These are normally accessed through `game.math`.
911
*
1012
* @class Phaser.Math
13+
* @static
14+
* @see {@link Phaser.Utils}
15+
* @see {@link Phaser.ArrayUtils}
1116
*/
1217
Phaser.Math = {
1318

1419
/**
1520
* Twice PI.
1621
* @property {number} Phaser.Math#PI2
1722
* @default ~6.283
23+
* @deprecated 2.1.4 - Not used internally. Use `2 * Math.PI` instead.
1824
*/
1925
PI2: Math.PI * 2,
2026

@@ -970,6 +976,8 @@ Phaser.Math = {
970976
},
971977

972978
/**
979+
* The (absolute) difference between two values.
980+
*
973981
* @method Phaser.Math#difference
974982
* @param {number} a
975983
* @param {number} b
@@ -1100,7 +1108,7 @@ Phaser.Math = {
11001108
* @method Phaser.Math#shift
11011109
* @param {array} stack - The array to shift.
11021110
* @return {any} The shifted value.
1103-
* @deprecated 2.1.4 - Not used internally, better to do locally
1111+
* @deprecated 2.1.4 - Specialized function. Not used internally, better to do locally
11041112
*/
11051113
shift: function (stack) {
11061114

@@ -1189,7 +1197,7 @@ Phaser.Math = {
11891197
},
11901198

11911199
/**
1192-
* Clamp value to range `[a, inf)`.
1200+
* Clamp `x` to the range `[a, Infinity)`.
11931201
* Roughly the same as `Math.max(x, a)`, except for NaN handling.
11941202
*
11951203
* @method Phaser.Math#clampBottom
@@ -1261,7 +1269,7 @@ Phaser.Math = {
12611269
/**
12621270
* A value representing the sign of the value: -1 for negative, +1 for positive, 0 if value is 0.
12631271
*
1264-
* This works differently from `Math.sign` for value of NaN and -0, etc.
1272+
* This works differently from `Math.sign` for values of NaN and -0, etc.
12651273
*
12661274
* @method Phaser.Math#sign
12671275
* @param {number} x

src/utils/ArrayUtils.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,13 +134,13 @@ Phaser.ArrayUtils = {
134134

135135
if (direction === 90 || direction === -270 || direction === 'rotateLeft')
136136
{
137-
matrix = Phaser.Utils.transposeArray(matrix);
137+
matrix = Phaser.ArrayUtils.transpose(matrix);
138138
matrix = matrix.reverse();
139139
}
140140
else if (direction === -90 || direction === 270 || direction === 'rotateRight')
141141
{
142142
matrix = matrix.reverse();
143-
matrix = Phaser.Utils.transposeArray(matrix);
143+
matrix = Phaser.ArrayUtils.transpose(matrix);
144144
}
145145
else if (Math.abs(direction) === 180 || direction === 'rotate180')
146146
{

0 commit comments

Comments
 (0)