diff --git a/packages/viewer/src/viewmodels/navigation.ts b/packages/viewer/src/viewmodels/navigation.ts index 8666a690f..d0fd8bdb9 100644 --- a/packages/viewer/src/viewmodels/navigation.ts +++ b/packages/viewer/src/viewmodels/navigation.ts @@ -353,7 +353,7 @@ class Navigation { if (this.viewerOptions.renderAllPages()) { const pageNumber = Number(pageNumberText); const epageNav = this.viewer.epageFromPageNumber(pageNumber); - this.viewer.navigateToEPage(epageNav); + this.viewer.navigateToEPage(epageNav, false); } else { const pageNumberElem = document.getElementById( "vivliostyle-page-number", @@ -553,7 +553,7 @@ class Navigation { ) as HTMLInputElement; const pageNumber = Number(pageNumberElem.value); const epageNav = this.viewer.epageFromPageNumber(pageNumber); - this.viewer.navigateToEPage(epageNav); + this.viewer.navigateToEPage(epageNav, false); return true; }; diff --git a/packages/viewer/src/viewmodels/viewer.ts b/packages/viewer/src/viewmodels/viewer.ts index 1beb66ae9..59f08955e 100644 --- a/packages/viewer/src/viewmodels/viewer.ts +++ b/packages/viewer/src/viewmodels/viewer.ts @@ -287,8 +287,8 @@ class Viewer { this.coreViewer.navigateToPage(Navigation.LAST); } - navigateToEPage(epage: number): void { - if (Math.abs(epage - this.epage()) > 1) { + navigateToEPage(epage: number, pushHistory?: boolean): void { + if (pushHistory === undefined || pushHistory) { window.history.pushState(null, null); } this.coreViewer.navigateToPage(Navigation.EPAGE, epage);