enhance(frontend): improve useScrollPositionKeeper

This commit is contained in:
syuilo 2025-06-24 20:30:32 +09:00
parent 36989e0cd3
commit 684424f26a
1 changed files with 6 additions and 0 deletions

View File

@ -22,6 +22,12 @@ export function useScrollPositionKeeper(scrollContainerRef: Ref<HTMLElement | nu
if (!el) return;
if (!ready) return;
if (el.scrollTop < 100) {
// 上部にいるときはanchorを参照するとズレの原因になるし位置復元するメリットも乏しいため設定しない
anchorId = null;
return;
}
const scrollContainerRect = el.getBoundingClientRect();
const viewPosition = scrollContainerRect.height / 2;