From 6ccca7ae5e4cd202e6a3b60ad199a4be0175d641 Mon Sep 17 00:00:00 2001 From: FragginWagon Date: Wed, 28 Jan 2026 20:14:52 +0000 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Improve=20scroll-to-result=20functi?= =?UTF-8?q?onality=20with=20smoother=20scrolling=20and=20fallback=20adjust?= =?UTF-8?q?ments?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pokedex.online/src/views/GamemasterExplorer.vue | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/code/websites/pokedex.online/src/views/GamemasterExplorer.vue b/code/websites/pokedex.online/src/views/GamemasterExplorer.vue index 43ad4a0..f380996 100644 --- a/code/websites/pokedex.online/src/views/GamemasterExplorer.vue +++ b/code/websites/pokedex.online/src/views/GamemasterExplorer.vue @@ -643,11 +643,11 @@ function scrollToResult() { if (lineIndex === undefined) return; const lineNumber = lineIndex + 1; // Convert to 1-based line number - + // Retry logic for virtual scroller rendering const attemptScroll = (attempt = 0) => { const lineElement = document.querySelector(`[data-line="${lineNumber}"]`); - + if (lineElement) { // Element is rendered, scroll it into view lineElement.scrollIntoView({ behavior: 'smooth', block: 'center' }); @@ -660,13 +660,15 @@ function scrollToResult() { // Fallback: scroll container to approximate position const container = document.querySelector('.scroller, .lines-container'); if (container) { - const estimatedScroll = (lineIndex / displayLines.value.length) * (container.scrollHeight - container.clientHeight); + const estimatedScroll = + (lineIndex / displayLines.value.length) * + (container.scrollHeight - container.clientHeight); container.scrollTop = estimatedScroll; } return false; } }; - + attemptScroll(); }