Merge pull request #14793 from Snuffleupagus/ensurePageViewVisible-spreads

Simplify spread-mode handling for the PAGE scroll-mode
This commit is contained in:
Tim van der Meij 2022-04-19 21:25:59 +02:00 committed by GitHub
commit 5032e357d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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;