This commit is contained in:
tamaina
2023-07-17 14:57:00 +00:00
parent d335da5ee4
commit 6152122d43

View File

@@ -182,10 +182,10 @@ watch([() => props.pagination.reversed, $$(scrollableElement)], () => {
scrollObserver = new IntersectionObserver(entries => { scrollObserver = new IntersectionObserver(entries => {
if (!active.value) return; // activeでない時は触らない if (!active.value) return; // activeでない時は触らない
weakBacked = entries[0].intersectionRatio > 0.1; weakBacked = entries[0].intersectionRatio > 0.02;
}, { }, {
root: scrollableElement, root: scrollableElement,
rootMargin: props.pagination.reversed ? '-1000% 0px 100% 0px' : '100% 0px -1000% 0px', rootMargin: props.pagination.reversed ? '-100% 0px 100% 0px' : '100% 0px -100% 0px',
threshold: [0, 0.01, 0.02, 0.04, 0.08, 0.1, 0.12], threshold: [0, 0.01, 0.02, 0.04, 0.08, 0.1, 0.12],
}); });
}, { immediate: true }); }, { immediate: true });
@@ -518,20 +518,11 @@ const prepend = (item: MisskeyEntity): void => {
if ( if (
!isPausingUpdate.value && // タブがバックグラウンドの時/スクロール調整中はキューに追加する !isPausingUpdate.value && // タブがバックグラウンドの時/スクロール調整中はキューに追加する
queueSize.value === 0 && // キューに残っている場合はキューに追加する queueSize.value === 0 && // キューに残っている場合はキューに追加する
active.value // keepAliveで隠されている間はキューに追加する active.value && // keepAliveで隠されている間はキューに追加する
!backed // 先頭に表示されていない時はキューに追加する
) { ) {
if (!backed) { if (items.value.has(item.id)) return; // 既にタイムラインにある場合は何もしない
// 先頭にいる場合は単に追加する unshiftItems([item]);
if (items.value.has(item.id)) return; // 既にタイムラインにある場合は何もしない
unshiftItems([item]);
} else if (!weakBacked) {
// ちょっと先頭にいる場合はスクロールを調整する
prependQueue(item);
executeQueue();
} else {
// 先頭にいない場合はキューに追加する
prependQueue(item);
}
} else { } else {
prependQueue(item); prependQueue(item);
} }