From 7c6eb4c849916f4f4a9b39217e2a7987521d2967 Mon Sep 17 00:00:00 2001 From: Jeremy Valentine <38669521+valentine195@users.noreply.github.com> Date: Wed, 20 Sep 2023 08:23:58 -0400 Subject: [PATCH] fix: Allow negative initiatives --- src/tracker/ui/creatures/Initiative.svelte | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/tracker/ui/creatures/Initiative.svelte b/src/tracker/ui/creatures/Initiative.svelte index bf0780e9..814e312f 100644 --- a/src/tracker/ui/creatures/Initiative.svelte +++ b/src/tracker/ui/creatures/Initiative.svelte @@ -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; @@ -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; }