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:
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user