Skip to content

Commit

Permalink
Merge pull request #9991 from Snuffleupagus/rm-deprecated-scroll-spread
Browse files Browse the repository at this point in the history
Remove the deprecated ways, in `BaseViewer`, of setting the Scroll/Spread modes (PR 9858 follow-up)
  • Loading branch information
timvandermeij authored Aug 20, 2018
2 parents 4ea663a + d7f6f4f commit 19e9a2b
Showing 1 changed file with 1 addition and 33 deletions.
34 changes: 1 addition & 33 deletions web/base_viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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(() => {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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}.
*/
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 19e9a2b

Please sign in to comment.