From 6bf6bb3a1c81662947676de9169ba65a5c43e576 Mon Sep 17 00:00:00 2001 From: FragginWagon Date: Wed, 28 Jan 2026 21:18:02 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20Improve=20code=20formatting=20an?= =?UTF-8?q?d=20readability=20in=20scroll=20position=20calculation=20logic?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pokedex.online/src/views/GamemasterExplorer.vue | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/code/websites/pokedex.online/src/views/GamemasterExplorer.vue b/code/websites/pokedex.online/src/views/GamemasterExplorer.vue index 07fcac8..3086ced 100644 --- a/code/websites/pokedex.online/src/views/GamemasterExplorer.vue +++ b/code/websites/pokedex.online/src/views/GamemasterExplorer.vue @@ -765,10 +765,11 @@ function scrollToResult() { 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); - + const targetScrollTop = + lineIndex * itemHeight - containerHeight / 2 + itemHeight / 2; + // Use the scroller's internal scrollTop scroller.$el.scrollTop = Math.max(0, targetScrollTop); });