Simplify spread-mode handling for the PAGE scroll-mode
The spread-mode code in `BaseViewer.#ensurePageViewVisible`-method was initially copied from the `BaseViewer._updateSpreadMode`-method, which means that it's slightly more complicated than actually necessary. In particular, in the PAGE scroll-mode there can only be *one* spread active at a time and we thus don't need to handle insertion of multiple spread-divs.
This commit is contained in:
parent
b73a6cc213
commit
03ec7a22f2
@ -920,24 +920,19 @@ class BaseViewer {
|
||||
}
|
||||
|
||||
// Finally, append the new pages to the viewer and apply the spreadMode.
|
||||
let spread = null;
|
||||
const spread = document.createElement("div");
|
||||
spread.className = "spread";
|
||||
|
||||
for (const i of pageIndexSet) {
|
||||
const pageView = this._pages[i];
|
||||
if (!pageView) {
|
||||
continue;
|
||||
}
|
||||
if (spread === null) {
|
||||
spread = document.createElement("div");
|
||||
spread.className = "spread";
|
||||
viewer.appendChild(spread);
|
||||
} else if (i % 2 === parity) {
|
||||
spread = spread.cloneNode(false);
|
||||
viewer.appendChild(spread);
|
||||
}
|
||||
spread.appendChild(pageView.div);
|
||||
|
||||
state.pages.push(pageView);
|
||||
}
|
||||
viewer.appendChild(spread);
|
||||
}
|
||||
|
||||
state.scrollDown = pageNumber >= state.previousPageNumber;
|
||||
|
Loading…
x
Reference in New Issue
Block a user