Merge pull request #6207 from Snuffleupagus/viewer-remove-setScale
Remove `PDFViewerApplication.setScale` and further simplify the `scalechange` event handler (issue 6158)
This commit is contained in:
commit
76d225dd3b
@ -298,7 +298,7 @@ var PDFViewerApplication = {
|
||||
newScale = Math.ceil(newScale * 10) / 10;
|
||||
newScale = Math.min(MAX_SCALE, newScale);
|
||||
} while (--ticks > 0 && newScale < MAX_SCALE);
|
||||
this.setScale(newScale, true);
|
||||
this.pdfViewer.currentScaleValue = newScale;
|
||||
},
|
||||
|
||||
zoomOut: function pdfViewZoomOut(ticks) {
|
||||
@ -308,7 +308,7 @@ var PDFViewerApplication = {
|
||||
newScale = Math.floor(newScale * 10) / 10;
|
||||
newScale = Math.max(MIN_SCALE, newScale);
|
||||
} while (--ticks > 0 && newScale > MIN_SCALE);
|
||||
this.setScale(newScale, true);
|
||||
this.pdfViewer.currentScaleValue = newScale;
|
||||
},
|
||||
|
||||
get pagesCount() {
|
||||
@ -969,14 +969,14 @@ var PDFViewerApplication = {
|
||||
} else if (storedHash) {
|
||||
this.pdfLinkService.setHash(storedHash);
|
||||
} else if (scale) {
|
||||
this.setScale(scale, true);
|
||||
this.pdfViewer.currentScaleValue = scale;
|
||||
this.page = 1;
|
||||
}
|
||||
|
||||
if (!this.pdfViewer.currentScaleValue) {
|
||||
// Scale was not initialized: invalid bookmark or scale was not specified.
|
||||
// Setting the default one.
|
||||
this.setScale(DEFAULT_SCALE_VALUE, true);
|
||||
this.pdfViewer.currentScaleValue = DEFAULT_SCALE_VALUE;
|
||||
}
|
||||
},
|
||||
|
||||
@ -1172,10 +1172,6 @@ var PDFViewerApplication = {
|
||||
this.forceRendering();
|
||||
},
|
||||
|
||||
setScale: function (value, resetAutoSettings) {
|
||||
this.pdfViewer.currentScaleValue = value;
|
||||
},
|
||||
|
||||
rotatePages: function pdfViewRotatePages(delta) {
|
||||
var pageNumber = this.page;
|
||||
this.pageRotation = (this.pageRotation + 360 + delta) % 360;
|
||||
@ -1443,9 +1439,8 @@ function webViewerInitialized() {
|
||||
}
|
||||
});
|
||||
|
||||
document.getElementById('scaleSelect').addEventListener('change',
|
||||
function() {
|
||||
PDFViewerApplication.setScale(this.value, false);
|
||||
document.getElementById('scaleSelect').addEventListener('change', function() {
|
||||
PDFViewerApplication.pdfViewer.currentScaleValue = this.value;
|
||||
});
|
||||
|
||||
document.getElementById('presentationMode').addEventListener('click',
|
||||
@ -1748,13 +1743,9 @@ window.addEventListener('scalechange', function scalechange(evt) {
|
||||
document.getElementById('zoomOut').disabled = (evt.scale === MIN_SCALE);
|
||||
document.getElementById('zoomIn').disabled = (evt.scale === MAX_SCALE);
|
||||
|
||||
if (evt.presetValue) {
|
||||
selectScaleOption(evt.presetValue);
|
||||
updateViewarea();
|
||||
return;
|
||||
}
|
||||
|
||||
var predefinedValueFound = selectScaleOption('' + evt.scale);
|
||||
// Update the 'scaleSelect' DOM element.
|
||||
var predefinedValueFound = selectScaleOption(evt.presetValue ||
|
||||
'' + evt.scale);
|
||||
if (!predefinedValueFound) {
|
||||
var customScaleOption = document.getElementById('customScaleOption');
|
||||
var customScale = Math.round(evt.scale * 10000) / 100;
|
||||
@ -1889,7 +1880,7 @@ window.addEventListener('keydown', function keydown(evt) {
|
||||
// keeping it unhandled (to restore page zoom to 100%)
|
||||
setTimeout(function () {
|
||||
// ... and resetting the scale after browser adjusts its scale
|
||||
PDFViewerApplication.setScale(DEFAULT_SCALE_VALUE, true);
|
||||
pdfViewer.currentScaleValue = DEFAULT_SCALE_VALUE;
|
||||
});
|
||||
handled = false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user