From 1a398b25280821dbec9e7372e83a12570c85ebab Mon Sep 17 00:00:00 2001 From: FragginWagon Date: Wed, 28 Jan 2026 21:17:57 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=AF=20Improve=20virtual=20scroller=20t?= =?UTF-8?q?o=20center=20items=20during=20scroll=20for=20better=20visibilit?= =?UTF-8?q?y?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pokedex.online/src/views/GamemasterExplorer.vue | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/code/websites/pokedex.online/src/views/GamemasterExplorer.vue b/code/websites/pokedex.online/src/views/GamemasterExplorer.vue index 3784bda..07fcac8 100644 --- a/code/websites/pokedex.online/src/views/GamemasterExplorer.vue +++ b/code/websites/pokedex.online/src/views/GamemasterExplorer.vue @@ -761,7 +761,16 @@ function scrollToResult() { // Use virtual scroller API if available (for large files) if (virtualScroller.value && displayLines.value.length > 1000) { nextTick(() => { - virtualScroller.value.scrollToItem(lineIndex); + // Calculate the scroll position to center the item + const scroller = virtualScroller.value; + const itemHeight = lineHeight.value; + const containerHeight = scroller.$el.clientHeight; + + // Calculate scroll position to center the item + const targetScrollTop = (lineIndex * itemHeight) - (containerHeight / 2) + (itemHeight / 2); + + // Use the scroller's internal scrollTop + scroller.$el.scrollTop = Math.max(0, targetScrollTop); }); } else { // Fallback for non-virtual scrolled content