mirror of
https://github.com/photonstorm/phaser
synced 2025-02-17 06:28:30 +00:00
Gets a value from an object with a min / max clamp.
This commit is contained in:
parent
c8d22fe881
commit
9ee3e759b5
1 changed files with 13 additions and 0 deletions
13
v3/src/utils/object/GetMinMaxValue.js
Normal file
13
v3/src/utils/object/GetMinMaxValue.js
Normal file
|
@ -0,0 +1,13 @@
|
|||
var GetObjectValue = require('./GetObjectValue');
|
||||
var Clamp = require('../../math/Clamp');
|
||||
|
||||
var GetMinMaxValue = function (source, key, min, max, defaultValue)
|
||||
{
|
||||
if (defaultValue === undefined) { defaultValue = min; }
|
||||
|
||||
var value = GetObjectValue(source, key, defaultValue);
|
||||
|
||||
return Clamp(value, min, max);
|
||||
};
|
||||
|
||||
module.exports = GetMinMaxValue;
|
Loading…
Add table
Reference in a new issue