Skip to content

Commit

Permalink
Merge pull request #8556 from Snuffleupagus/app-remove-pageRotation
Browse files Browse the repository at this point in the history
Stop tracking the rotation in `PDFViewerApplication` and directly use `PDFViewer.pagesRotation` instead
  • Loading branch information
timvandermeij committed Jun 21, 2017
2 parents 5ff4cd8 + 83673a1 commit 36fb368
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions web/app.js
Expand Up @@ -134,7 +134,6 @@ var PDFViewerApplication = {
eventBus: null,
/** @type {IL10n} */
l10n: null,
pageRotation: 0,
isInitialViewSet: false,
downloadComplete: false,
viewerPrefs: {
Expand Down Expand Up @@ -451,6 +450,10 @@ var PDFViewerApplication = {
return this.pdfDocument ? this.pdfDocument.numPages : 0;
},

get pageRotation() {
return this.pdfViewer.pagesRotation;
},

set page(val) {
this.pdfViewer.currentPageNumber = val;
},
Expand Down Expand Up @@ -601,7 +604,6 @@ var PDFViewerApplication = {
this.pdfDocumentProperties.setDocument(null, null);
}
this.store = null;
this.pageRotation = 0;
this.isInitialViewSet = false;
this.downloadComplete = false;

Expand Down Expand Up @@ -1244,14 +1246,16 @@ var PDFViewerApplication = {
if (!this.pdfDocument) {
return;
}
let pageNumber = this.page;
this.pageRotation = (this.pageRotation + 360 + delta) % 360;
this.pdfViewer.pagesRotation = this.pageRotation;
this.pdfThumbnailViewer.pagesRotation = this.pageRotation;
let { pdfViewer, pdfThumbnailViewer, } = this;
let pageNumber = pdfViewer.currentPageNumber;
let newRotation = (pdfViewer.pagesRotation + 360 + delta) % 360;

this.forceRendering();
pdfViewer.pagesRotation = newRotation;
pdfThumbnailViewer.pagesRotation = newRotation;

this.pdfViewer.currentPageNumber = pageNumber;
this.forceRendering();
// Ensure that the active page doesn't change during rotation.
pdfViewer.currentPageNumber = pageNumber;
},

requestPresentationMode: function pdfViewRequestPresentationMode() {
Expand Down

0 comments on commit 36fb368

Please sign in to comment.