Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the viewer option from the PDFPresentationMode constructor #11388

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion web/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,6 @@ let PDFViewerApplication = {
if (this.supportsFullscreen) {
this.pdfPresentationMode = new PDFPresentationMode({
container,
viewer,
pdfViewer: this.pdfViewer,
eventBus,
contextMenuItems: appConfig.fullscreen,
Expand Down
7 changes: 2 additions & 5 deletions web/pdf_presentation_mode.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ const SWIPE_ANGLE_THRESHOLD = Math.PI / 6;
/**
* @typedef {Object} PDFPresentationModeOptions
* @property {HTMLDivElement} container - The container for the viewer element.
* @property {HTMLDivElement} [viewer] - The viewer element.
* @property {PDFViewer} pdfViewer - The document viewer.
* @property {EventBus} eventBus - The application event bus.
* @property {Array} [contextMenuItems] - The menu items that are added to the
Expand All @@ -43,10 +42,8 @@ class PDFPresentationMode {
/**
* @param {PDFPresentationModeOptions} options
*/
constructor({ container, viewer = null, pdfViewer, eventBus,
contextMenuItems = null, }) {
constructor({ container, pdfViewer, eventBus, contextMenuItems = null, }) {
this.container = container;
this.viewer = viewer || container.firstElementChild;
this.pdfViewer = pdfViewer;
this.eventBus = eventBus;

Expand Down Expand Up @@ -82,7 +79,7 @@ class PDFPresentationMode {
* @returns {boolean} Indicating if the request was successful.
*/
request() {
if (this.switchInProgress || this.active || !this.viewer.hasChildNodes()) {
if (this.switchInProgress || this.active || !this.pdfViewer.pagesCount) {
return false;
}
this._addFullscreenChangeListeners();
Expand Down