Skip to content

Commit cbf3957

Browse files
committed
Allow non-zero min in FromPercent
`FromPercent` silently assumed `min` to be 0. Shifting the result by `min` makes it work as documented and gives a value between `min` and `max`. Our uses of `FromPercent` only have `min` at 0, so there is no regression in our code. This is merely a fix for 3rd party users.
1 parent 1ebfdef commit cbf3957

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/math/FromPercent.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ var FromPercent = function (percent, min, max)
2222
{
2323
percent = Clamp(percent, 0, 1);
2424

25-
return (max - min) * percent;
25+
return (max - min) * percent + min;
2626
};
2727

2828
module.exports = FromPercent;

0 commit comments

Comments
 (0)