Skip to content

Commit

Permalink
Merge pull request #7040 from Snuffleupagus/remove-PDFThumbnailViewer…
Browse files Browse the repository at this point in the history
…_ensureThumbnailVisible

Remove `PDFThumbnailViewer_ensureThumbnailVisible`
  • Loading branch information
timvandermeij committed Feb 28, 2016
2 parents 9ff6c83 + 39cba5d commit 4d9a3d4
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 15 deletions.
7 changes: 0 additions & 7 deletions web/pdf_presentation_mode.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ var CONTROLS_SELECTOR = 'pdfPresentationModeControls';
* @property {HTMLDivElement} container - The container for the viewer element.
* @property {HTMLDivElement} viewer - (optional) The viewer element.
* @property {PDFViewer} pdfViewer - The document viewer.
* @property {PDFThumbnailViewer} pdfThumbnailViewer - (optional) The thumbnail
* viewer.
* @property {Array} contextMenuItems - (optional) The menuitems that are added
* to the context menu in Presentation Mode.
*/
Expand All @@ -43,7 +41,6 @@ var PDFPresentationMode = (function PDFPresentationModeClosure() {
this.container = options.container;
this.viewer = options.viewer || options.container.firstElementChild;
this.pdfViewer = options.pdfViewer;
this.pdfThumbnailViewer = options.pdfThumbnailViewer || null;
var contextMenuItems = options.contextMenuItems || null;

this.active = false;
Expand Down Expand Up @@ -245,10 +242,6 @@ var PDFPresentationMode = (function PDFPresentationModeClosure() {
this._resetMouseScrollState();
this.container.removeAttribute('contextmenu');
this.contextMenuOpen = false;

if (this.pdfThumbnailViewer) {
this.pdfThumbnailViewer.ensureThumbnailVisible(page);
}
},

/**
Expand Down
8 changes: 8 additions & 0 deletions web/pdf_sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,14 @@ var PDFSidebar = (function PDFSidebarClosure() {
self.switchView(SidebarView.THUMBS);
}
});

// Update the thumbnailViewer, if visible, when exiting presentation mode.
window.addEventListener('presentationmodechanged', function(evt) {
if (!evt.detail.active && !evt.detail.switchInProgress &&
self.isThumbnailViewVisible) {
self._updateThumbnailViewer();
}
});
},
};

Expand Down
7 changes: 0 additions & 7 deletions web/pdf_thumbnail_viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,13 +178,6 @@ var PDFThumbnailViewer = (function PDFThumbnailViewerClosure() {
return promise;
},

ensureThumbnailVisible:
function PDFThumbnailViewer_ensureThumbnailVisible(page) {
// Ensure that the thumbnail of the current page is visible
// when switching from another view.
scrollIntoView(document.getElementById('thumbnailContainer' + page));
},

forceRendering: function () {
var visibleThumbs = this._getVisibleThumbs();
var thumbView = this.renderingQueue.getHighestPriority(visibleThumbs,
Expand Down
1 change: 0 additions & 1 deletion web/viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,6 @@ var PDFViewerApplication = {
container: container,
viewer: viewer,
pdfViewer: this.pdfViewer,
pdfThumbnailViewer: this.pdfThumbnailViewer,
contextMenuItems: [
{ element: document.getElementById('contextFirstPage'),
handler: toolbar.firstPageClick.bind(toolbar) },
Expand Down

0 comments on commit 4d9a3d4

Please sign in to comment.