From 53eb13a7d187884207e7d6f7ff9005e2d17abfcb Mon Sep 17 00:00:00 2001 From: Talal Abou Haiba Date: Sat, 4 Jan 2025 13:13:39 -0800 Subject: [PATCH] Fix #6 - observe both columns when loading more images --- main.ts | 16 ++++++++++------ manifest.json | 2 +- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/main.ts b/main.ts index 5e7ed51..fadd172 100644 --- a/main.ts +++ b/main.ts @@ -92,13 +92,16 @@ class ImageSelectorModal extends Modal { // Get the width of the viewport const totalWidth = contentEl.innerWidth; - const imageDiv = contentEl.createDiv({cls: 'row'}); - const left = imageDiv.createDiv({cls: 'column'}); - const right = imageDiv.createDiv({cls: 'column'}); - const bottomDiv = contentEl.createDiv(); + const row = contentEl.createDiv({cls: 'row'}); + const leftImageDiv = row.createDiv({cls: 'column'}); + const rightImageDiv = row.createDiv({cls: 'column'}); + const left = leftImageDiv.createDiv(); + const right = rightImageDiv.createDiv(); + const leftBottom = leftImageDiv.createDiv(); + const rightBottom = rightImageDiv.createDiv(); let observer = new IntersectionObserver(() => { const startIndex = this.page; - let endIndex = this.page + 4; + let endIndex = this.page + 10; if (endIndex > cachedResult.json['assets'].length) { endIndex = cachedResult.json['assets'].length; } @@ -123,7 +126,8 @@ class ImageSelectorModal extends Modal { } }, {threshold: [0.1]}); - observer.observe(bottomDiv); + observer.observe(leftBottom); + observer.observe(rightBottom); } onClose() { diff --git a/manifest.json b/manifest.json index be47199..526175f 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "immich", "name": "Immich", - "version": "0.1.1", + "version": "0.1.2", "minAppVersion": "0.15.0", "description": "Link your Immich images within your vault.", "author": "Talal Abou Haiba",