Skip to content

Commit

Permalink
Prevent opening previous/next chapter on page selection
Browse files Browse the repository at this point in the history
In case the first/last page was opened and a specific page was selected, instead of opening the page, the previous/next chapter was opened due to incorrectly handling the page change as a previous/next page change
  • Loading branch information
schroda committed Dec 13, 2024
1 parent f69fbd7 commit 33910cc
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/modules/reader/services/ReaderControls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,14 @@ export class ReaderControls {
setIsOverlayVisible(false);
}

const hideTransitionPage = () => setTransitionPageMode(ReaderTransitionPageMode.NONE);

if (typeof page === 'number') {
setPageToScrollToIndex(page);
hideTransitionPage();
return;
}

const shouldOpenPreviousChapter =
isFirstPage && isATransitionPageVisible && convertedPage === 'previous' && !!previousChapter;
if (shouldOpenPreviousChapter) {
Expand All @@ -292,14 +300,6 @@ export class ReaderControls {
return;
}

const hideTransitionPage = () => setTransitionPageMode(ReaderTransitionPageMode.NONE);

if (typeof page === 'number') {
setPageToScrollToIndex(page);
hideTransitionPage();
return;
}

const needToHideTransitionPage = isATransitionPageVisible && !isContinuousReadingModeActive;
switch (convertedPage) {
case 'previous':
Expand Down

0 comments on commit 33910cc

Please sign in to comment.