Skip to content

Commit

Permalink
fix(viewer): Navigation with page slider should not affect browser hi…
Browse files Browse the repository at this point in the history
…story stack

- fix #1219
  • Loading branch information
MurakamiShinyu committed Aug 31, 2023
1 parent a7b1ed7 commit 7b3f117
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/viewer/src/viewmodels/navigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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;
};
Expand Down
4 changes: 2 additions & 2 deletions packages/viewer/src/viewmodels/viewer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 7b3f117

Please sign in to comment.