Skip to content

Commit e68087e

Browse files
committed
Extract get all pages method
1 parent b114634 commit e68087e

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/Main.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ function onPageLoad() {
318318
draggable: ImageDraggableMetadata,
319319
pageOverlaysMap: Map<number, PageOverlays>
320320
) {
321-
const pages = document.querySelectorAll("#content .page");
321+
const pages = view.getAllPages();
322322

323323
const pagesToIncludeImage = getPagesOverlappingOverlay(
324324
pages,
@@ -413,7 +413,7 @@ function onPageLoad() {
413413
pageOverlaysMap: Map<number, PageOverlays>
414414
) {
415415
const textInput = draggable.textInput;
416-
const pages = document.querySelectorAll("#content .page");
416+
const pages = view.getAllPages();
417417
if (textInput) {
418418
const pagesToIncludeImage = getPagesOverlappingOverlay(
419419
pages,

src/View.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,10 @@ export class View {
564564
});
565565
}
566566

567+
public getAllPages(): NodeListOf<Element> {
568+
return document.querySelectorAll("#content .page");
569+
}
570+
567571
private calculateSmallestZIndex(collection: Array<HTMLElement>): number {
568572
return Math.min(
569573
...Array.from(collection, (el) => parseInt(getComputedStyle(el).zIndex))

0 commit comments

Comments
 (0)