From 008c5a799a76dc3cb05c10b94df83635b293a6d3 Mon Sep 17 00:00:00 2001 From: legonzaur Date: Thu, 4 May 2023 21:53:54 +0200 Subject: [PATCH] prevent scroll is no player is highlighted --- src/components/List/VirtualList.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/List/VirtualList.vue b/src/components/List/VirtualList.vue index ac09a29..1d17c1f 100644 --- a/src/components/List/VirtualList.vue +++ b/src/components/List/VirtualList.vue @@ -47,7 +47,7 @@ export default defineComponent({ this.vlistHeight = (this.$refs.vlist as HTMLElement)?.getBoundingClientRect().height || 0 }, highlighted (newVal) { - setTimeout(() => (this.$refs.vlist as HTMLElement)?.scrollBy({ top: ((this.list.findIndex(e => e.id === newVal)) * this.rowHeight) - ((this.$refs.vlist as HTMLElement))?.scrollTop - (this.vlistHeight / 2 - this.$props.rowHeight), behavior: 'smooth' }), 1) + if (newVal) setTimeout(() => (this.$refs.vlist as HTMLElement)?.scrollBy({ top: ((this.list.findIndex(e => e.id === newVal)) * this.rowHeight) - ((this.$refs.vlist as HTMLElement))?.scrollTop - (this.vlistHeight / 2 - this.$props.rowHeight), behavior: 'smooth' }), 1) } }, methods: {