Skip to content

Commit

Permalink
Allow math to be typed into onion skinning inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
Jazza-231 committed Oct 24, 2023
1 parent 1d0fe1c commit 4093621
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions addons/onion-skinning/userscript.js
Original file line number Diff line number Diff line change
Expand Up @@ -632,18 +632,22 @@ export default async function ({ addon, console, msg }) {
settingsChanged();
return;
}
let value = +currentInput.value;
if (value > +currentInput.max) {
value = +currentInput.max;
} else if (value < 0) {
value = 0;
let value = currentInput.value;
if (!isNaN(currentInput.value)) {
value = +currentInput.value;
if (value > +currentInput.max) {
value = +currentInput.max;
} else if (value < 0) {
value = 0;
}
}

currentInput.value = value;
settings[type] = value;
settingsChanged();
});
currentInput.addEventListener("blur", () => {
if (!currentInput.value) {
if (!currentInput.value || isNaN(currentInput.value)) {
currentInput.value = "0";
}
});
Expand Down

0 comments on commit 4093621

Please sign in to comment.