diff --git a/www/ftui/modules/ftui/ftui.helper.js b/www/ftui/modules/ftui/ftui.helper.js index 8c622b84..2b0f5570 100755 --- a/www/ftui/modules/ftui/ftui.helper.js +++ b/www/ftui/modules/ftui/ftui.helper.js @@ -423,9 +423,18 @@ export function formatMoney(amount) { } export function scale(value, minIn, maxIn, minOut, maxOut) { - const slope = (minOut - maxOut) / (minIn - maxIn); - const intercept = slope * -(minIn) + minOut; - return value * slope + intercept; + if(value <= minIn) { + return minOut; + } + else if(value >= maxIn) { + return maxOut; + } + else + { + const slope = (minOut - maxOut) / (minIn - maxIn); + const intercept = slope * -(minIn) + minOut; + return value * slope + intercept; + } } export function limit(value, minIn, maxIn) {