Prevent hiding overlay on page change through overlay

This commit is contained in:
schroda
2024-12-13 02:15:18 +01:00
parent e944831862
commit aaf7fb7b30
4 changed files with 19 additions and 9 deletions

View File

@@ -237,7 +237,11 @@ export class ReaderControls {
});
}
static useOpenPage(): (page: number | 'previous' | 'next', forceDirection?: Direction) => void {
static useOpenPage(): (
page: number | 'previous' | 'next',
forceDirection?: Direction,
hideOverlay?: boolean,
) => void {
const { currentPageIndex, setPageToScrollToIndex, pages, transitionPageMode, setTransitionPageMode } =
userReaderStatePagesContext();
const { previousChapter, nextChapter } = useReaderStateChaptersContext();
@@ -263,14 +267,16 @@ export class ReaderControls {
const isContinuousReadingModeActive = isContinuousReadingMode(readingMode.value);
return useCallback(
(page, forceDirection = direction) => {
(page, forceDirection = direction, hideOverlay: boolean = true) => {
const convertedPage = getOptionForDirection(
page,
page === 'previous' ? 'next' : 'previous',
forceDirection,
);
setIsOverlayVisible(false);
if (hideOverlay) {
setIsOverlayVisible(false);
}
const shouldOpenPreviousChapter =
isFirstPage && isATransitionPageVisible && convertedPage === 'previous' && !!previousChapter;