Skip to content

Commit 8015194

Browse files
committed
Fix normalizeAngle and wrapAngle (again?)
1 parent 7d7aa79 commit 8015194

1 file changed

Lines changed: 2 additions & 18 deletions

File tree

src/math/Math.js

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ Phaser.Math = {
351351
if (typeof radians === "undefined") { radians = true; }
352352

353353
var rd = (radians) ? Math.PI : 180;
354-
return this.wrap(angle, rd, -rd);
354+
return this.wrap(angle, -rd, rd);
355355

356356
},
357357

@@ -656,23 +656,7 @@ Phaser.Math = {
656656
*/
657657
wrapAngle: function (angle) {
658658

659-
var result = angle;
660-
661-
// Nothing needs to change
662-
if (angle >= -180 && angle <= 180)
663-
{
664-
return angle;
665-
}
666-
667-
// Else normalise it to -180, 180
668-
result = (angle + 180) % 360;
669-
670-
if (result < 0)
671-
{
672-
result += 360;
673-
}
674-
675-
return result - 180;
659+
return this.wrap(angle, -180, 180);
676660

677661
},
678662

0 commit comments

Comments
 (0)