Browse Source

Remove the scale-not-initialized hack from `webViewerResize` (in app.js)

Since we no longer, after PR 8555, allow changing the scale until the document is loaded, that hack is no longer necessary. Furthermore, no part of that event handling function needs to run unless a document is loaded.

The reason that this hack was initially added, is that previously the `ViewHistory` might be updated *before* `PDFViewerApplication.setInitialView` had run (in some cases leading to incorrect inital document scale). Since that is no longer possible, this is now dead code.
Jonas Jenwald 8 years ago
parent
commit
8391aacb89
  1. 15
      web/app.js

15
web/app.js

@ -1790,19 +1790,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