From 779151f7b31b8a513e1d20ee822b507d5ceff6aa Mon Sep 17 00:00:00 2001 From: Marc Seitz Date: Tue, 2 Jul 2024 09:37:47 +0200 Subject: [PATCH] fix: scroll beyond numpages --- components/view/PagesViewerNew.tsx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/components/view/PagesViewerNew.tsx b/components/view/PagesViewerNew.tsx index cf144798c..b6b344a3d 100644 --- a/components/view/PagesViewerNew.tsx +++ b/components/view/PagesViewerNew.tsx @@ -431,8 +431,7 @@ export default function PagesViewer({ if (isVertical) { scrollActionRef.current = true; const newScrollPosition = - ((pageNumber - 2) * containerRef.current!.scrollHeight) / - numPagesWithAccountCreation; + (pageNumber - 2) * containerRef.current!.clientHeight; containerRef.current?.scrollTo({ top: newScrollPosition, behavior: "smooth", @@ -478,8 +477,7 @@ export default function PagesViewer({ if (isVertical) { scrollActionRef.current = true; const newScrollPosition = - (pageNumber * containerRef.current!.scrollHeight) / - numPagesWithAccountCreation; + pageNumber * containerRef.current!.clientHeight; containerRef.current?.scrollTo({ top: newScrollPosition, behavior: "smooth",