Merge pull request #8556 from Snuffleupagus/app-remove-pageRotation

Stop tracking the rotation in `PDFViewerApplication` and directly use `PDFViewer.pagesRotation` instead
This commit is contained in:
Tim van der Meij 2017-06-22 00:03:58 +02:00 committed by GitHub
commit 36fb3686cc

View File

@ -134,7 +134,6 @@ var PDFViewerApplication = {
eventBus: null, eventBus: null,
/** @type {IL10n} */ /** @type {IL10n} */
l10n: null, l10n: null,
pageRotation: 0,
isInitialViewSet: false, isInitialViewSet: false,
downloadComplete: false, downloadComplete: false,
viewerPrefs: { viewerPrefs: {
@ -451,6 +450,10 @@ var PDFViewerApplication = {
return this.pdfDocument ? this.pdfDocument.numPages : 0; return this.pdfDocument ? this.pdfDocument.numPages : 0;
}, },
get pageRotation() {
return this.pdfViewer.pagesRotation;
},
set page(val) { set page(val) {
this.pdfViewer.currentPageNumber = val; this.pdfViewer.currentPageNumber = val;
}, },
@ -601,7 +604,6 @@ 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.downloadComplete = false;
@ -1244,14 +1246,16 @@ var PDFViewerApplication = {
if (!this.pdfDocument) { if (!this.pdfDocument) {
return; return;
} }
let pageNumber = this.page; let { pdfViewer, pdfThumbnailViewer, } = this;
this.pageRotation = (this.pageRotation + 360 + delta) % 360; let pageNumber = pdfViewer.currentPageNumber;
this.pdfViewer.pagesRotation = this.pageRotation; let newRotation = (pdfViewer.pagesRotation + 360 + delta) % 360;
this.pdfThumbnailViewer.pagesRotation = this.pageRotation;
pdfViewer.pagesRotation = newRotation;
pdfThumbnailViewer.pagesRotation = newRotation;
this.forceRendering(); this.forceRendering();
// Ensure that the active page doesn't change during rotation.
this.pdfViewer.currentPageNumber = pageNumber; pdfViewer.currentPageNumber = pageNumber;
}, },
requestPresentationMode: function pdfViewRequestPresentationMode() { requestPresentationMode: function pdfViewRequestPresentationMode() {