Update virtual scroll when note scale is changed

This commit is contained in:
Dallas Hoffman 2023-09-25 23:22:04 -04:00
parent 94d5a97da3
commit be1270c10e
No known key found for this signature in database
1 changed files with 10 additions and 1 deletions

View File

@ -14,6 +14,7 @@
let notesOffset = 0; let notesOffset = 0;
let notesLimit = 100; let notesLimit = 100;
let prevNotesCount = 0; let prevNotesCount = 0;
let prevRowHeight = 0;
const { noteScale } = settings; const { noteScale } = settings;
let scaleUnsubscribe: Unsubscriber; let scaleUnsubscribe: Unsubscriber;
@ -36,11 +37,19 @@
Math.min(notesCount - offset, Math.ceil(windowHeight / rowHeight) + paddingRows * 2) * Math.min(notesCount - offset, Math.ceil(windowHeight / rowHeight) + paddingRows * 2) *
columnCount; columnCount;
if (offset === notesOffset && limit === notesLimit && notesCount === prevNotesCount) return; if (
offset === notesOffset &&
limit === notesLimit &&
notesCount === prevNotesCount &&
rowHeight === prevRowHeight
) {
return;
}
notesOffset = offset; notesOffset = offset;
notesLimit = limit; notesLimit = limit;
prevNotesCount = notesCount; prevNotesCount = notesCount;
prevRowHeight = rowHeight;
await notes.setPage(offset, limit); await notes.setPage(offset, limit);
scrollHeight = Math.max(0, fullHeight); scrollHeight = Math.max(0, fullHeight);