Skip to content

Commit 511b2f0

Browse files
committed
Merge pull request phaserjs#597 from Cryszon/patch-1
Added support for radians in wrapAngle
2 parents 928b883 + 97a838e commit 511b2f0

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

src/math/Math.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -774,11 +774,12 @@ Phaser.Math = {
774774
*
775775
* @method Phaser.Math#wrapAngle
776776
* @param {number} angle - The angle value to check
777+
* @param {boolean} radians - True if angle sizes are expressed in radians.
777778
* @return {number} The new angle value, returns the same as the input angle if it was within bounds.
778779
*/
779-
wrapAngle: function (angle) {
780-
781-
return this.wrap(angle, -180, 180);
780+
wrapAngle: function (angle, radians) {
781+
var radianFactor = (radians) ? Math.PI / 180 : 1;
782+
return this.wrap(angle, -180 * radianFactor, 180 * radianFactor);
782783

783784
},
784785

0 commit comments

Comments
 (0)