Browse Source

Merge pull request #8618 from Snuffleupagus/webViewerResize-rm-hack

Remove the scale-not-initialized hack from `webViewerResize` (in app.js)
Tim van der Meij 8 years ago committed by GitHub
parent
commit
d95022328c
  1. 21
      web/app.js

21
web/app.js

@ -985,6 +985,12 @@ let PDFViewerApplication = {
pdfViewer.currentScaleValue = pdfViewer.currentScaleValue; pdfViewer.currentScaleValue = pdfViewer.currentScaleValue;
this.setInitialView(initialParams.hash); this.setInitialView(initialParams.hash);
}).then(function() {
// At this point, rendering of the initial page(s) should always have
// started (and may even have completed).
// To prevent any future issues, e.g. the document being completely
// blank on load, always trigger rendering here.
pdfViewer.update();
}); });
}); });
@ -1793,19 +1799,18 @@ function webViewerUpdateViewarea(evt) {
} }
function webViewerResize() { function webViewerResize() {
let currentScaleValue = PDFViewerApplication.pdfViewer.currentScaleValue; let { pdfDocument, pdfViewer, } = PDFViewerApplication;
if (!pdfDocument) {
return;
}
let currentScaleValue = pdfViewer.currentScaleValue;
if (currentScaleValue === 'auto' || if (currentScaleValue === 'auto' ||
currentScaleValue === 'page-fit' || currentScaleValue === 'page-fit' ||
currentScaleValue === 'page-width') { currentScaleValue === 'page-width') {
// Note: the scale is constant for 'page-actual'. // Note: the scale is constant for 'page-actual'.
PDFViewerApplication.pdfViewer.currentScaleValue = currentScaleValue; pdfViewer.currentScaleValue = currentScaleValue;
} else if (!currentScaleValue) {
// Normally this shouldn't happen, but if the scale wasn't initialized
// we set it to the default value in order to prevent any issues.
// (E.g. the document being rendered with the wrong scale on load.)
PDFViewerApplication.pdfViewer.currentScaleValue = DEFAULT_SCALE_VALUE;
} }
PDFViewerApplication.pdfViewer.update(); pdfViewer.update();
} }
function webViewerHashchange(evt) { function webViewerHashchange(evt) {

Loading…
Cancel
Save