Scroll to start of page on page change
Resets the scroll position for single/double page mode to the start of the opened page on a page change.
This commit is contained in:
@@ -37,6 +37,7 @@ import {
|
||||
createPagesData,
|
||||
getDoublePageModePages,
|
||||
getScrollIntoViewInlineOption,
|
||||
getScrollToXForReadingDirection,
|
||||
isSpreadPage,
|
||||
} from '@/modules/reader/utils/ReaderPager.utils.tsx';
|
||||
import { useReaderScrollbarContext } from '@/modules/reader/contexts/ReaderScrollbarContext.tsx';
|
||||
@@ -227,6 +228,13 @@ const BaseReaderViewer = forwardRef(
|
||||
});
|
||||
}
|
||||
|
||||
if (!isContinuousReadingModeActive) {
|
||||
scrollElementRef.current?.scrollTo(
|
||||
getScrollToXForReadingDirection(scrollElementRef.current, themeDirection, readingDirection),
|
||||
0,
|
||||
);
|
||||
}
|
||||
|
||||
const newPageIndex = getNextIndexFromPage(pageToScrollTo);
|
||||
const isLastPage = newPageIndex === totalPages - 1;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user