Merge pull request #14793 from Snuffleupagus/ensurePageViewVisible-spreads
Simplify spread-mode handling for the PAGE scroll-mode
This commit is contained in:
commit
5032e357d4
@ -920,24 +920,19 @@ class BaseViewer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Finally, append the new pages to the viewer and apply the spreadMode.
|
// 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) {
|
for (const i of pageIndexSet) {
|
||||||
const pageView = this._pages[i];
|
const pageView = this._pages[i];
|
||||||
if (!pageView) {
|
if (!pageView) {
|
||||||
continue;
|
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);
|
spread.appendChild(pageView.div);
|
||||||
|
|
||||||
state.pages.push(pageView);
|
state.pages.push(pageView);
|
||||||
}
|
}
|
||||||
|
viewer.appendChild(spread);
|
||||||
}
|
}
|
||||||
|
|
||||||
state.scrollDown = pageNumber >= state.previousPageNumber;
|
state.scrollDown = pageNumber >= state.previousPageNumber;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user