From fa4ff45b1c45667ebec81e1a8923778e02cda5eb Mon Sep 17 00:00:00 2001 From: cnouguier Date: Sat, 24 Aug 2024 07:04:11 +0200 Subject: [PATCH] feat: Provide a new TimeLine component (close #909) --- core/client/components/collection/KScrollDown.vue | 2 +- core/client/components/collection/KTimeLine.vue | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/core/client/components/collection/KScrollDown.vue b/core/client/components/collection/KScrollDown.vue index fdf77b84c..6a1bae29f 100644 --- a/core/client/components/collection/KScrollDown.vue +++ b/core/client/components/collection/KScrollDown.vue @@ -75,7 +75,7 @@ function scrollOnce () { const targetElement = document.getElementById(props.target) if (!targetElement) return const position = qScrollUtils.getVerticalScrollPosition(targetElement) - qScrollUtils.setVerticalScrollPosition(targetElement, position + targetElement.offsetHeight, props.duration) + qScrollUtils.setVerticalScrollPosition(targetElement, position + targetElement.offsetHeight * .75, props.duration) refresh() } diff --git a/core/client/components/collection/KTimeLine.vue b/core/client/components/collection/KTimeLine.vue index 8d03c3125..adfb70e93 100644 --- a/core/client/components/collection/KTimeLine.vue +++ b/core/client/components/collection/KTimeLine.vue @@ -310,6 +310,12 @@ function onScroll () { if (scrollToTopRef.value) scrollToTopRef.value.refresh() } function onLoad (index, done) { + // check whether the items are all loaded yet + if (items.value.length === nbTotalItems.value) { + done(true) + return + } + // set the current page and tell the collection to be refreshed currentPage.value = index refreshCollection() loadDoneFunction.value = done