feat(queue): add scroll to currently playing button

Adds a scrollToIndex method to VirtualList and a locate button in the
Queue header that scrolls to center the currently playing track.
This commit is contained in:
2026-02-12 22:00:03 -08:00
parent c0ff938bf3
commit 63145c128e
2 changed files with 36 additions and 7 deletions

View File

@@ -56,6 +56,14 @@
scrollTop = (e.target as HTMLDivElement).scrollTop;
}
export function scrollToIndex(index: number) {
if (!containerEl) return;
containerEl.scrollTop = Math.max(
0,
index * itemHeight - containerHeight / 2 + itemHeight / 2,
);
}
$effect(() => {
if (!containerEl) return;
const ro = new ResizeObserver((entries) => {