Fix scrollToIndex

This commit is contained in:
wvffle 2022-07-24 23:57:41 +00:00 committed by Georg Krause
parent d1b8190dca
commit fa68ff76d8
3 changed files with 5 additions and 3 deletions

View File

@ -85,9 +85,10 @@ const scrollToCurrent = (behavior: ScrollBehavior = 'smooth') => {
watchDebounced(currentTrack, () => scrollToCurrent(), { debounce: 100 }) watchDebounced(currentTrack, () => scrollToCurrent(), { debounce: 100 })
whenever( whenever(
() => store.state.ui.queueFocused, () => store.state.ui.queueFocused,
() => { async () => {
list.value?.scrollToIndex(currentIndex.value) list.value?.scrollToIndex(currentIndex.value)
setTimeout(() => scrollToCurrent('auto'), 1) await nextTick()
requestAnimationFrame(() => scrollToCurrent('auto'))
} }
) )

View File

@ -156,6 +156,7 @@ const { resume, pause } = useRafFn(() => {
}, { immediate: false }) }, { immediate: false })
const virtualList = ref() const virtualList = ref()
window.vl = virtualList
defineExpose({ defineExpose({
scrollToIndex: (index: number) => virtualList.value?.scrollToItem(index), scrollToIndex: (index: number) => virtualList.value?.scrollToItem(index),
cleanup cleanup

View File

@ -344,7 +344,7 @@
} }
} }
.drag-container:not(.dragging) .queue-item:hover { .drag-container:not(.dragging) .hover .queue-item {
background: rgba(0,0,0,.05); background: rgba(0,0,0,.05);
color: #000000f2; color: #000000f2;
} }