-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Closed
Labels
Description
Version
- Phaser Version: 3.60
Description
After the 3.60 wrap change to have check that made sure if it was in the range it return the same result.
if (value >= min && value <= max)
{
// Skip modulo if already in range
return value;
}
But if that will lead to inconsistent behavior if the value is out of range for example
wrap(4,0,4) == 4
wrap(8,0,4) == 0
But is should be the same because 8 is double of 4.
Before 3.60 the check was not there and wrap was consistent.
Example Test Code
console.log(Phaser.Math.Wrap(4,0,4)); // 4
console.log(Phaser.Math.Wrap(8,0,4)); // 0
console.log(Phaser.Math.Wrap(8,0,4) === Phaser.Math.Wrap(4,0,4)); //false
Additional Information
I don't know if this it intended behavior or a bug, if it is bug the i gladly make a pull request with the required changes