mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-09 01:35:43 +02:00
Remove the view
-specific getters in the PDFSidebar
class
With the exception of `isThumbnailViewVisible`, these getters are completely unused. Generally speaking, using the `visibleView`-getter directly works just as well and seems (at least to me) to be overall preferable considering how our classes are usually implemented.
This commit is contained in:
parent
e6a0a953e8
commit
13fda7caeb
2 changed files with 8 additions and 26 deletions
16
web/app.js
16
web/app.js
|
@ -1765,7 +1765,7 @@ const PDFViewerApplication = {
|
|||
forceRendering() {
|
||||
this.pdfRenderingQueue.printing = !!this.printService;
|
||||
this.pdfRenderingQueue.isThumbnailViewEnabled =
|
||||
this.pdfSidebar.isThumbnailViewVisible;
|
||||
this.pdfSidebar.visibleView === SidebarView.THUMBS;
|
||||
this.pdfRenderingQueue.renderHighestPriority();
|
||||
},
|
||||
|
||||
|
@ -2261,7 +2261,7 @@ function webViewerPageRendered({ pageNumber, error }) {
|
|||
}
|
||||
|
||||
// Use the rendered page to set the corresponding thumbnail image.
|
||||
if (PDFViewerApplication.pdfSidebar.isThumbnailViewVisible) {
|
||||
if (PDFViewerApplication.pdfSidebar.visibleView === SidebarView.THUMBS) {
|
||||
const pageView = PDFViewerApplication.pdfViewer.getPageView(
|
||||
/* index = */ pageNumber - 1
|
||||
);
|
||||
|
@ -2338,21 +2338,19 @@ function webViewerPresentationModeChanged(evt) {
|
|||
PDFViewerApplication.pdfViewer.presentationModeState = evt.state;
|
||||
}
|
||||
|
||||
function webViewerSidebarViewChanged(evt) {
|
||||
function webViewerSidebarViewChanged({ view }) {
|
||||
PDFViewerApplication.pdfRenderingQueue.isThumbnailViewEnabled =
|
||||
PDFViewerApplication.pdfSidebar.isThumbnailViewVisible;
|
||||
view === SidebarView.THUMBS;
|
||||
|
||||
if (PDFViewerApplication.isInitialViewSet) {
|
||||
// Only update the storage when the document has been loaded *and* rendered.
|
||||
PDFViewerApplication.store?.set("sidebarView", evt.view).catch(() => {
|
||||
PDFViewerApplication.store?.set("sidebarView", view).catch(() => {
|
||||
// Unable to write to storage.
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function webViewerUpdateViewarea(evt) {
|
||||
const location = evt.location;
|
||||
|
||||
function webViewerUpdateViewarea({ location }) {
|
||||
if (PDFViewerApplication.isInitialViewSet) {
|
||||
// Only update the storage when the document has been loaded *and* rendered.
|
||||
PDFViewerApplication.store
|
||||
|
@ -2587,7 +2585,7 @@ function webViewerPageChanging({ pageNumber, pageLabel }) {
|
|||
PDFViewerApplication.toolbar.setPageNumber(pageNumber, pageLabel);
|
||||
PDFViewerApplication.secondaryToolbar.setPageNumber(pageNumber);
|
||||
|
||||
if (PDFViewerApplication.pdfSidebar.isThumbnailViewVisible) {
|
||||
if (PDFViewerApplication.pdfSidebar.visibleView === SidebarView.THUMBS) {
|
||||
PDFViewerApplication.pdfThumbnailViewer.scrollThumbnailIntoView(pageNumber);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue