Fix clamp function
This commit is contained in:
parent
2c7742e56f
commit
f2c973096b
|
@ -328,12 +328,11 @@ function configDialog(style) {
|
||||||
|
|
||||||
// Clamp input[type=number] to a valid range
|
// Clamp input[type=number] to a valid range
|
||||||
function clampValue(value, va, break = false) {
|
function clampValue(value, va, break = false) {
|
||||||
const max = isNumber(va.max) ? va.max : 100;
|
|
||||||
if (isNumber(va.min) && value < va.min) {
|
if (isNumber(va.min) && value < va.min) {
|
||||||
return min;
|
return va.min;
|
||||||
}
|
}
|
||||||
if (value > max) {
|
if (isNumber(va.max) && value > va.max) {
|
||||||
return max;
|
return va.max;
|
||||||
}
|
}
|
||||||
// Don't restrict to integer values if step is undefined.
|
// Don't restrict to integer values if step is undefined.
|
||||||
if (!isNumber(va.step) || break) {
|
if (!isNumber(va.step) || break) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user