Replace setScrollMode/setSpreadMode methods with getters/setters

Since all the other viewer methods use the getter/setter pattern, e.g. for setting page/scale/rotation, the way that the Scroll/Spread modes are set thus stands out. For consistency, this really ought to use the same pattern as the rest of the `BaseViewer`. (To avoid breaking third-party implementations, the old methods are kept around as aliases.)
This commit is contained in:
Jonas Jenwald 2018-06-29 15:07:42 +02:00
parent 9515f579c6
commit a7ac27e385
3 changed files with 63 additions and 39 deletions

View file

@ -1250,10 +1250,10 @@ let PDFViewerApplication = {
};
let setViewerModes = (scroll, spread) => {
if (Number.isInteger(scroll)) {
this.pdfViewer.setScrollMode(scroll);
this.pdfViewer.scrollMode = scroll;
}
if (Number.isInteger(spread)) {
this.pdfViewer.setSpreadMode(spread);
this.pdfViewer.spreadMode = spread;
}
};
@ -2019,10 +2019,10 @@ function webViewerRotateCcw() {
PDFViewerApplication.rotatePages(-90);
}
function webViewerSwitchScrollMode(evt) {
PDFViewerApplication.pdfViewer.setScrollMode(evt.mode);
PDFViewerApplication.pdfViewer.scrollMode = evt.mode;
}
function webViewerSwitchSpreadMode(evt) {
PDFViewerApplication.pdfViewer.setSpreadMode(evt.mode);
PDFViewerApplication.pdfViewer.spreadMode = evt.mode;
}
function webViewerDocumentProperties() {
PDFViewerApplication.pdfDocumentProperties.open();