Fix SpinBox writing NaNs into deck config

Partial fix for #2353
This commit is contained in:
Damien Elmes 2023-01-28 20:14:05 +10:00
parent 17480a2c80
commit c7e49d8708

View file

@ -26,12 +26,11 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
$: if (value) stringValue = value.toFixed(decimalPlaces(step));
function update(this: HTMLInputElement): void {
value = Math.min(max, Math.max(min, parseFloat(this.value)));
if (value > max) {
value = max;
} else if (value < min) {
value = min;
const newValue = parseFloat(this.value);
if (Number.isNaN(newValue)) {
return;
}
value = Math.min(max, Math.max(min, newValue));
}
function handleWheel(event: WheelEvent) {