Skip to content

Commit

Permalink
fix: Allow negative initiatives
Browse files Browse the repository at this point in the history
  • Loading branch information
valentine195 committed Sep 20, 2023
1 parent 7a3c4f1 commit 7c6eb4c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/tracker/ui/creatures/Initiative.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
}}
on:blur={function (evt) {
const value = this.value;
if (isNaN(Number(value)) || Number(value) < 1) {
if (isNaN(Number(value))) {
new Notice("Enter a valid initiative.");
this.value = `${initiative}`;
return;
Expand All @@ -36,7 +36,9 @@
this.blur();
return;
}
if (!/^(\d*\.?\d*|Backspace|Delete|Arrow\w+)$/.test(evt.key)) {
if (
!/^(-?\d*\.?\d*|Backspace|Delete|Arrow\w+)$/.test(evt.key)
) {
evt.preventDefault();
return false;
}
Expand Down

0 comments on commit 7c6eb4c

Please sign in to comment.