From 09db67f3b104ef6e61a49e6df8fe46c5233cbea7 Mon Sep 17 00:00:00 2001 From: Terry Truong Date: Sun, 15 May 2022 18:35:25 +1000 Subject: For overflowing tiles, load some out-of-view child tiles Intended to reduce cases of tiles becoming visible after their area is scrolled into view. Doesn't really help if user scrolls quickly, and rows have many tiles. --- src/components/Tile.vue | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/Tile.vue b/src/components/Tile.vue index da3c29c..38a3e12 100644 --- a/src/components/Tile.vue +++ b/src/components/Tile.vue @@ -58,6 +58,9 @@ export default defineComponent({ break; } } + const NUM_EXTRA = 10; + firstIdx = Math.max(0, firstIdx - NUM_EXTRA); + lastIdx = Math.min(children.length, lastIdx + NUM_EXTRA); return children.slice(firstIdx, lastIdx); }, // Basic abbreviations @@ -375,7 +378,7 @@ export default defineComponent({ console.log('handling scroll') this.scrollOffset = this.$el.scrollTop; this.pendingScrollHdlr = 0; - }, 50); + }, 300); } }, // Other -- cgit v1.2.3