Remove PDFThumbnailViewer_ensureThumbnailVisible

Functionality wise, `ensureThumbnailVisible` is essentially just a shorthand for `scrollThumbnailIntoView`. (And note that `PDFViewer` doesn't implement a `ensurePageVisible` method.)

The only remaining usage of `PDFThumbnailViewer_ensureThumbnailVisible` is inside `PDFPresentationMode`, which introduces an otherwise unnecessary `PDFThumbnailViewer` dependency there.

We're already relying on the `presentationmodechanged` event, in various files, to track the state of Presentation Mode. Thus we can simply listen for that event in `PDFSidebar` too, and update the thumbnails if necessary.
This commit is contained in:
Jonas Jenwald 2016-02-28 13:16:08 +01:00
parent 9ff6c83bb6
commit 39cba5d25d
4 changed files with 8 additions and 15 deletions

View file

@ -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();
}
});
},
};