From 56c73abc05f8e8819fe3b0d4c9132709b047f764 Mon Sep 17 00:00:00 2001 From: meowarex Date: Tue, 24 Feb 2026 23:25:21 +1100 Subject: [PATCH] CodeReview --- plugins/radiant-lyrics-luna/src/Settings.tsx | 2 +- plugins/radiant-lyrics-luna/src/index.ts | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/plugins/radiant-lyrics-luna/src/Settings.tsx b/plugins/radiant-lyrics-luna/src/Settings.tsx index a543b37..3f4e3ba 100644 --- a/plugins/radiant-lyrics-luna/src/Settings.tsx +++ b/plugins/radiant-lyrics-luna/src/Settings.tsx @@ -201,7 +201,7 @@ export const Settings = () => { title="Lyrics Style" desc="0 = Line (default), 1 = Word, 2 = Syllable (mirrored in lyrics dropdown)" min={0} - max={1} + max={2} step={1} value={lyricsStyle} onNumber={(value: number) => { diff --git a/plugins/radiant-lyrics-luna/src/index.ts b/plugins/radiant-lyrics-luna/src/index.ts index 498ee73..e5e3c78 100644 --- a/plugins/radiant-lyrics-luna/src/index.ts +++ b/plugins/radiant-lyrics-luna/src/index.ts @@ -1298,13 +1298,13 @@ let syncButtonEl: HTMLElement | null = null; // scroll bounce animation state let scrollAnimIsAnimating = false; let scrollAnimPending: { parent: HTMLElement; refIdx: number; target: number } | null = null; -let scrollUnlockTimeout: ReturnType | null = null; -let scrollCleanupTimeout: ReturnType | null = null; +let scrollUnlockTimeout: LunaUnload | null = null; +let scrollCleanupTimeout: LunaUnload | null = null; let animatingEls: HTMLElement[] = []; const clearScrollAnim = (): void => { - if (scrollUnlockTimeout) { clearTimeout(scrollUnlockTimeout); scrollUnlockTimeout = null; } - if (scrollCleanupTimeout) { clearTimeout(scrollCleanupTimeout); scrollCleanupTimeout = null; } + if (scrollUnlockTimeout) { scrollUnlockTimeout(); scrollUnlockTimeout = null; } + if (scrollCleanupTimeout) { scrollCleanupTimeout(); scrollCleanupTimeout = null; } for (const el of animatingEls) { el.classList.remove("rl-scroll-animate"); el.style.removeProperty("--rl-scroll-delta"); @@ -1323,8 +1323,8 @@ const applyScrollBounce = (scrollParent: HTMLElement, referenceIdx: number, scro } // clear previous animation timeouts - if (scrollUnlockTimeout) { clearTimeout(scrollUnlockTimeout); scrollUnlockTimeout = null; } - if (scrollCleanupTimeout) { clearTimeout(scrollCleanupTimeout); scrollCleanupTimeout = null; } + if (scrollUnlockTimeout) { scrollUnlockTimeout(); scrollUnlockTimeout = null; } + if (scrollCleanupTimeout) { scrollCleanupTimeout(); scrollCleanupTimeout = null; } // clean up previous animation classes for (const el of animatingEls) { @@ -1386,7 +1386,7 @@ const applyScrollBounce = (scrollParent: HTMLElement, referenceIdx: number, scro // unlock animation state after base duration, process pending if queued const BASE_DURATION = 400; - scrollUnlockTimeout = setTimeout(() => { + scrollUnlockTimeout = safeTimeout(unloads, () => { scrollAnimIsAnimating = false; if (scrollAnimPending) { const pending = scrollAnimPending; @@ -1396,7 +1396,7 @@ const applyScrollBounce = (scrollParent: HTMLElement, referenceIdx: number, scro }, BASE_DURATION); // clean up animation classes after all staggered animations complete - scrollCleanupTimeout = setTimeout(() => { + scrollCleanupTimeout = safeTimeout(unloads, () => { for (const el of animatingEls) { el.classList.remove("rl-scroll-animate"); el.style.removeProperty("--rl-scroll-delta");