Merge pull request #9991 from Snuffleupagus/rm-deprecated-scroll-spread

Remove the deprecated ways, in `BaseViewer`, of setting the Scroll/Spread modes (PR 9858 follow-up)
This commit is contained in:
Tim van der Meij 2018-08-20 23:45:22 +02:00 committed by GitHub
commit 19e9a2bf34
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -145,7 +145,6 @@ class BaseViewer {
this.removePageBorders = options.removePageBorders || false;
this.textLayerMode = Number.isInteger(options.textLayerMode) ?
options.textLayerMode : TextLayerMode.ENABLE;
this.enhanceTextSelection = options.enhanceTextSelection || false;
this.imageResourcesPath = options.imageResourcesPath || '';
this.renderInteractiveForms = options.renderInteractiveForms || false;
this.enablePrintAutoRotate = options.enablePrintAutoRotate || false;
@ -171,19 +170,6 @@ class BaseViewer {
if (this.removePageBorders) {
this.viewer.classList.add('removePageBorders');
}
if ((typeof PDFJSDev === 'undefined' || PDFJSDev.test('GENERIC')) &&
('scrollMode' in options || 'spreadMode' in options)) {
console.error(`The ${this._name} constructor options ` +
'`scrollMode`/`spreadMode` are deprecated, use the setters instead.');
if (options.scrollMode !== undefined) {
this.scrollMode = options.scrollMode;
}
if (options.spreadMode !== undefined) {
this.spreadMode = options.spreadMode;
}
}
// Defer the dispatching of this event, to give other viewer components
// time to initialize *and* register 'baseviewerinit' event listeners.
Promise.resolve().then(() => {
@ -607,9 +593,7 @@ class BaseViewer {
let vPadding = noPadding ? 0 : VERTICAL_PADDING;
if (!noPadding && this._isScrollModeHorizontal) {
const temp = hPadding;
hPadding = vPadding;
vPadding = temp;
[hPadding, vPadding] = [vPadding, hPadding]; // Swap the padding values.
}
let pageWidthScale = (this.container.clientWidth - hPadding) /
currentPage.width * currentPage.scale;
@ -1080,14 +1064,6 @@ class BaseViewer {
this.update();
}
setScrollMode(mode) {
if (typeof PDFJSDev === 'undefined' || PDFJSDev.test('GENERIC')) {
console.error(`${this._name}.setScrollMode() is deprecated, ` +
`use the ${this._name}.scrollMode setter instead.`);
this.scrollMode = mode;
}
}
/**
* @return {number} One of the values in {SpreadMode}.
*/
@ -1147,14 +1123,6 @@ class BaseViewer {
this.scrollPageIntoView({ pageNumber, });
this.update();
}
setSpreadMode(mode) {
if (typeof PDFJSDev === 'undefined' || PDFJSDev.test('GENERIC')) {
console.error(`${this._name}.setSpreadMode() is deprecated, ` +
`use the ${this._name}.spreadMode setter instead.`);
this.spreadMode = mode;
}
}
}
export {