From c638c899c097e1fb9c7f24cecad4afa1ca85e01a Mon Sep 17 00:00:00 2001 From: Pinapelz Date: Thu, 16 Apr 2026 20:45:20 -0700 Subject: fix: allow offset to be negative in player control panel --- src/app/player/page.tsx | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'src/app') diff --git a/src/app/player/page.tsx b/src/app/player/page.tsx index 2ac6d50..0806c3b 100644 --- a/src/app/player/page.tsx +++ b/src/app/player/page.tsx @@ -63,6 +63,7 @@ function KaraokePage() { const supplementAudioRef = useRef(null); const [captionsText, setCaptionsText] = useState(""); const [offset, setOffset] = useState(0); + const [offsetInput, setOffsetInput] = useState("0"); const [dragOver, setDragOver] = useState(false); const [statusText, setStatusText] = useState("No video selected"); const [balance, setBalance] = useState(0); @@ -94,6 +95,10 @@ function KaraokePage() { localStorage.setItem("fontColor", fontColor); }, [fontColor]); + useEffect(() => { + setOffsetInput(String(offset)); + }, [offset]); + const handleResizeMouseDown = useCallback( (e: React.MouseEvent) => { e.preventDefault(); @@ -567,8 +572,19 @@ function KaraokePage() { Offset setOffset(Number(e.target.value))} + value={offsetInput} + onChange={(e) => { + const next = e.target.value; + if (next === "" || next === "-" || next === "+") { + setOffsetInput(next); + return; + } + const parsed = Number(next); + if (!Number.isNaN(parsed)) { + setOffset(parsed); + setOffsetInput(next); + } + }} step="25" /> -- cgit v1.2.3