Browse Source

Reset `pageRotation` and `downloadComplete` in `PDFViewerApplication.close`

Currently, these properties are reset in what appears to be somewhat arbitrary locations (within the `load` and `open` methods respectively). The explanation is probably that both of these properties predates the existence of any centralized clean-up code in the viewer.

Hence I think that it makes sense to move the resetting of these properties to the `close` method, since that improves the overview of what's actually cleaned-up/reset when changing documents in the viewer.
Jonas Jenwald 8 years ago
parent
commit
e4d032c5c7
  1. 14
      web/app.js

14
web/app.js

@ -136,6 +136,7 @@ var PDFViewerApplication = {
l10n: null, l10n: null,
pageRotation: 0, pageRotation: 0,
isInitialViewSet: false, isInitialViewSet: false,
downloadComplete: false,
viewerPrefs: { viewerPrefs: {
sidebarViewOnLoad: SidebarView.NONE, sidebarViewOnLoad: SidebarView.NONE,
pdfBugEnabled: false, pdfBugEnabled: false,
@ -599,7 +600,9 @@ var PDFViewerApplication = {
this.pdfDocumentProperties.setDocument(null, null); this.pdfDocumentProperties.setDocument(null, null);
} }
this.store = null; this.store = null;
this.pageRotation = 0;
this.isInitialViewSet = false; this.isInitialViewSet = false;
this.downloadComplete = false;
this.pdfSidebar.reset(); this.pdfSidebar.reset();
this.pdfOutlineViewer.reset(); this.pdfOutlineViewer.reset();
@ -669,8 +672,6 @@ var PDFViewerApplication = {
} }
} }
this.downloadComplete = false;
let loadingTask = getDocument(parameters); let loadingTask = getDocument(parameters);
this.pdfLoadingTask = loadingTask; this.pdfLoadingTask = loadingTask;
@ -911,8 +912,6 @@ var PDFViewerApplication = {
let pagesPromise = pdfViewer.pagesPromise; let pagesPromise = pdfViewer.pagesPromise;
let onePageRendered = pdfViewer.onePageRendered; let onePageRendered = pdfViewer.onePageRendered;
this.pageRotation = 0;
let pdfThumbnailViewer = this.pdfThumbnailViewer; let pdfThumbnailViewer = this.pdfThumbnailViewer;
pdfThumbnailViewer.setDocument(pdfDocument); pdfThumbnailViewer.setDocument(pdfDocument);
@ -1241,8 +1240,11 @@ var PDFViewerApplication = {
this.forceRendering(); this.forceRendering();
}, },
rotatePages: function pdfViewRotatePages(delta) { rotatePages(delta) {
var pageNumber = this.page; if (!this.pdfDocument) {
return;
}
let pageNumber = this.page;
this.pageRotation = (this.pageRotation + 360 + delta) % 360; this.pageRotation = (this.pageRotation + 360 + delta) % 360;
this.pdfViewer.pagesRotation = this.pageRotation; this.pdfViewer.pagesRotation = this.pageRotation;
this.pdfThumbnailViewer.pagesRotation = this.pageRotation; this.pdfThumbnailViewer.pagesRotation = this.pageRotation;

Loading…
Cancel
Save