From be1270c10edefa1fe6537896b4f10b1fac5a364c Mon Sep 17 00:00:00 2001 From: Dallas Hoffman Date: Mon, 25 Sep 2023 23:22:04 -0400 Subject: [PATCH] Update virtual scroll when note scale is changed --- src/lib/components/notes/note-list.svelte | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/lib/components/notes/note-list.svelte b/src/lib/components/notes/note-list.svelte index d18a689..4b31181 100644 --- a/src/lib/components/notes/note-list.svelte +++ b/src/lib/components/notes/note-list.svelte @@ -14,6 +14,7 @@ let notesOffset = 0; let notesLimit = 100; let prevNotesCount = 0; + let prevRowHeight = 0; const { noteScale } = settings; let scaleUnsubscribe: Unsubscriber; @@ -36,11 +37,19 @@ Math.min(notesCount - offset, Math.ceil(windowHeight / rowHeight) + paddingRows * 2) * columnCount; - if (offset === notesOffset && limit === notesLimit && notesCount === prevNotesCount) return; + if ( + offset === notesOffset && + limit === notesLimit && + notesCount === prevNotesCount && + rowHeight === prevRowHeight + ) { + return; + } notesOffset = offset; notesLimit = limit; prevNotesCount = notesCount; + prevRowHeight = rowHeight; await notes.setPage(offset, limit); scrollHeight = Math.max(0, fullHeight);