Skip to content

Commit

Permalink
Always open first/last page when closing chapter transition page
Browse files Browse the repository at this point in the history
When e.g. enabling the "offset spread pages" setting the current page index was still the one of the secondary page, which then caused the first page to get skipped.
  • Loading branch information
schroda committed Dec 17, 2024
1 parent 392998f commit 0771eab
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/modules/reader/services/ReaderControls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ export class ReaderControls {
() => getNextPageIndex('next', currentPage.pagesIndex, pages),
[currentPage, pages],
);
const indexOfFirstPage = getNextIndexFromPage(pages[0]);
const indexOfLastPage = getNextIndexFromPage(pages[pages.length - 1]);
const direction = READING_DIRECTION_TO_THEME_DIRECTION[readingDirection.value];

Expand Down Expand Up @@ -310,6 +311,7 @@ export class ReaderControls {

if (needToHideTransitionPage) {
hideTransitionPage();
setPageToScrollToIndex(indexOfLastPage);
return;
}

Expand All @@ -323,6 +325,7 @@ export class ReaderControls {

if (needToHideTransitionPage) {
hideTransitionPage();
setPageToScrollToIndex(indexOfFirstPage);
return;
}

Expand All @@ -334,6 +337,8 @@ export class ReaderControls {
},
[
direction,
indexOfFirstPage,
indexOfLastPage,
previousPageIndex,
nextPageIndex,
indexOfLastPage,
Expand Down

0 comments on commit 0771eab

Please sign in to comment.