diff --git a/src/components/ScrollerManager.vue b/src/components/ScrollerManager.vue index a36adce7..34b1f001 100644 --- a/src/components/ScrollerManager.vue +++ b/src/components/ScrollerManager.vue @@ -506,6 +506,7 @@ export default defineComponent({ interactend() { this.interacting = false; this.recyclerScrolled(null); // make sure final position is correct + this.$emit("interactend"); // tell recycler to load stuff }, /** Update scroller is being used to scroll recycler */ diff --git a/src/components/Timeline.vue b/src/components/Timeline.vue index e78255f7..53a822f4 100644 --- a/src/components/Timeline.vue +++ b/src/components/Timeline.vue @@ -80,6 +80,7 @@ :height="scrollerHeight" :recycler="$refs.recycler" :recyclerBefore="$refs.recyclerBefore" + @interactend="loadScrollView()" /> { - // Get the overlapping range between startIndex and - // currentStart and endIndex and currentEnd. - // This is the range of rows that we need to update. - const start = Math.max(startIndex, this.currentStart); - const end = Math.min(endIndex, this.currentEnd); - - if (end - start > 0) { - this.loadScrollChanges(start, end); - } - }, SCROLL_LOAD_DELAY); + // Debounce; only execute the newest call after delay + utils.setRenewingTimeout( + this, + "_scrollChangeTimer", + this.loadScrollView, + delay + ); }, - /** Load image data for given view */ - loadScrollChanges(startIndex: number, endIndex: number) { + /** Load image data for given view (index based) */ + loadScrollView(startIndex?: number, endIndex?: number) { + // Default values if not defined + startIndex ??= this.currentStart; + endIndex ??= this.currentEnd; + // Check if any side needs a padding. // Whenever less than half rows are loaded, we need to pad with full // rows on that side. This ensures we have minimal reflows.