Always scroll to start of page on page change

By the time the scroll area got scrolled to the start of the visible pages, the previous/next page wasn't yet shown and thus, the scrollable area wasn't updated yet.
Thus, in case the scrollable area grew in width due to the page change, the start never got scrolled into view due to triggering the logic too early.
This commit is contained in:
schroda
2025-01-10 02:03:31 +01:00
parent e4e38e74b3
commit afc3a23ae0
2 changed files with 24 additions and 8 deletions

View File

@@ -54,6 +54,7 @@ import {
useReaderHideCursorOnInactivity,
useReaderHideOverlayOnUserScroll,
useReaderHorizontalModeInvertXYScrolling,
useReaderScrollToStartOnPageChange,
} from '@/modules/reader/utils/Reader.utils.ts';
import { TReaderTapZoneContext } from '@/modules/reader/types/TapZoneLayout.types.ts';
import { useReaderTapZoneContext } from '@/modules/reader/contexts/ReaderTapZoneContext.tsx';
@@ -223,6 +224,12 @@ const BaseReaderViewer = forwardRef(
imageRefs,
themeDirection,
readingDirection,
);
useReaderScrollToStartOnPageChange(
currentPageIndex,
isContinuousReadingModeActive,
themeDirection,
readingDirection,
scrollElementRef,
);
useReaderHideCursorOnInactivity(scrollElementRef);