mirror of
https://github.com/photonstorm/phaser
synced 2025-02-17 14:38:30 +00:00
Refined Math.Clamp.
This commit is contained in:
parent
6aae306aa0
commit
04e54efe43
1 changed files with 1 additions and 12 deletions
|
@ -9,18 +9,7 @@
|
|||
*/
|
||||
var Clamp = function (v, min, max)
|
||||
{
|
||||
if (v < min)
|
||||
{
|
||||
return min;
|
||||
}
|
||||
else if (max < v)
|
||||
{
|
||||
return max;
|
||||
}
|
||||
else
|
||||
{
|
||||
return v;
|
||||
}
|
||||
return Math.max(min, Math.min(max, value));
|
||||
};
|
||||
|
||||
module.exports = Clamp;
|
||||
|
|
Loading…
Add table
Reference in a new issue