mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-09 17:55:37 +02:00
Change the scrollMode
/spreadMode
to "private" properties on BaseViewer
instances
This commit is contained in:
parent
a9a93bd923
commit
9515f579c6
2 changed files with 14 additions and 14 deletions
|
@ -27,7 +27,7 @@ class PDFViewer extends BaseViewer {
|
|||
const left = pageDiv.offsetLeft + pageDiv.clientLeft;
|
||||
const right = left + pageDiv.clientWidth;
|
||||
const { scrollLeft, clientWidth, } = this.container;
|
||||
if (this.scrollMode === ScrollMode.HORIZONTAL ||
|
||||
if (this._scrollMode === ScrollMode.HORIZONTAL ||
|
||||
left < scrollLeft || right > scrollLeft + clientWidth) {
|
||||
pageSpot = { left: 0, top: 0, };
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ class PDFViewer extends BaseViewer {
|
|||
_getVisiblePages() {
|
||||
if (!this.isInPresentationMode) {
|
||||
return getVisibleElements(this.container, this._pages, true,
|
||||
this.scrollMode === ScrollMode.HORIZONTAL);
|
||||
this._scrollMode === ScrollMode.HORIZONTAL);
|
||||
}
|
||||
// The algorithm in getVisibleElements doesn't work in all browsers and
|
||||
// configurations when presentation mode is active.
|
||||
|
@ -91,11 +91,11 @@ class PDFViewer extends BaseViewer {
|
|||
// Used to ensure that pre-rendering of the next/previous page works
|
||||
// correctly, since Scroll/Spread modes are ignored in Presentation Mode.
|
||||
return (this.isInPresentationMode ?
|
||||
false : this.scrollMode === ScrollMode.HORIZONTAL);
|
||||
false : this._scrollMode === ScrollMode.HORIZONTAL);
|
||||
}
|
||||
|
||||
setScrollMode(mode) {
|
||||
if (mode === this.scrollMode) {
|
||||
if (mode === this._scrollMode) {
|
||||
return;
|
||||
}
|
||||
super.setScrollMode(mode);
|
||||
|
@ -118,7 +118,7 @@ class PDFViewer extends BaseViewer {
|
|||
}
|
||||
|
||||
_updateScrollModeClasses() {
|
||||
const { scrollMode, viewer, } = this;
|
||||
const scrollMode = this._scrollMode, viewer = this.viewer;
|
||||
|
||||
if (scrollMode === ScrollMode.HORIZONTAL) {
|
||||
viewer.classList.add('scrollHorizontal');
|
||||
|
@ -133,7 +133,7 @@ class PDFViewer extends BaseViewer {
|
|||
}
|
||||
|
||||
setSpreadMode(mode) {
|
||||
if (mode === this.spreadMode) {
|
||||
if (mode === this._spreadMode) {
|
||||
return;
|
||||
}
|
||||
super.setSpreadMode(mode);
|
||||
|
@ -150,12 +150,12 @@ class PDFViewer extends BaseViewer {
|
|||
// Temporarily remove all the pages from the DOM.
|
||||
viewer.textContent = '';
|
||||
|
||||
if (this.spreadMode === SpreadMode.NONE) {
|
||||
if (this._spreadMode === SpreadMode.NONE) {
|
||||
for (let i = 0, iMax = pages.length; i < iMax; ++i) {
|
||||
viewer.appendChild(pages[i].div);
|
||||
}
|
||||
} else {
|
||||
const parity = this.spreadMode - 1;
|
||||
const parity = this._spreadMode - 1;
|
||||
let spread = null;
|
||||
for (let i = 0, iMax = pages.length; i < iMax; ++i) {
|
||||
if (spread === null) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue