diff --git a/web/base_viewer.js b/web/base_viewer.js index f055122b2..3ba5d3a9d 100644 --- a/web/base_viewer.js +++ b/web/base_viewer.js @@ -1321,8 +1321,6 @@ class BaseViewer { : currentScaleValue; const pageNumber = firstPage.id; - let pdfOpenParams = "#page=" + pageNumber; - pdfOpenParams += "&zoom=" + normalizedScaleValue; const currentPageView = this._pages[pageNumber - 1]; const container = this.container; const topLeft = currentPageView.getPagePoint( @@ -1331,7 +1329,11 @@ class BaseViewer { ); const intLeft = Math.round(topLeft[0]); const intTop = Math.round(topLeft[1]); - pdfOpenParams += "," + intLeft + "," + intTop; + + let pdfOpenParams = `#page=${pageNumber}`; + if (!this.isInPresentationMode) { + pdfOpenParams += `&zoom=${normalizedScaleValue},${intLeft},${intTop}`; + } this._location = { pageNumber, diff --git a/web/pdf_history.js b/web/pdf_history.js index c6ef42cc7..b7dec87af 100644 --- a/web/pdf_history.js +++ b/web/pdf_history.js @@ -16,11 +16,7 @@ /** @typedef {import("./event_utils").EventBus} EventBus */ /** @typedef {import("./interfaces").IPDFLinkService} IPDFLinkService */ -import { - isValidRotation, - parseQueryString, - PresentationModeState, -} from "./ui_utils.js"; +import { isValidRotation, parseQueryString } from "./ui_utils.js"; import { waitOnEventOrTimeout } from "./event_utils.js"; // Heuristic value used when force-resetting `this._blockHashChange`. @@ -69,13 +65,8 @@ class PDFHistory { this.reset(); this._boundEvents = null; - this._isViewerInPresentationMode = false; - // Ensure that we don't miss either a 'presentationmodechanged' or a - // 'pagesinit' event, by registering the listeners immediately. - this.eventBus._on("presentationmodechanged", evt => { - this._isViewerInPresentationMode = - evt.state !== PresentationModeState.NORMAL; - }); + // Ensure that we don't miss a "pagesinit" event, + // by registering the listener immediately. this.eventBus._on("pagesinit", () => { this._isPagesLoaded = false; @@ -566,9 +557,7 @@ class PDFHistory { } this._position = { - hash: this._isViewerInPresentationMode - ? `page=${location.pageNumber}` - : location.pdfOpenParams.substring(1), + hash: location.pdfOpenParams.substring(1), page: this.linkService.page, first: location.pageNumber, rotation: location.rotation,