Skip to content

Commit

Permalink
Added support for radians in wrapAngle
Browse files Browse the repository at this point in the history
My first time proposing a change in GitHub, so I hope I did it correctly.
  • Loading branch information
Cryszon committed Mar 18, 2014
1 parent 928b883 commit 97a838e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/math/Math.js
Original file line number Diff line number Diff line change
Expand Up @@ -774,11 +774,12 @@ Phaser.Math = {
*
* @method Phaser.Math#wrapAngle
* @param {number} angle - The angle value to check
* @param {boolean} radians - True if angle sizes are expressed in radians.
* @return {number} The new angle value, returns the same as the input angle if it was within bounds.
*/
wrapAngle: function (angle) {

return this.wrap(angle, -180, 180);
wrapAngle: function (angle, radians) {
var radianFactor = (radians) ? Math.PI / 180 : 1;
return this.wrap(angle, -180 * radianFactor, 180 * radianFactor);

},

Expand Down

0 comments on commit 97a838e

Please sign in to comment.