fix(rework): 자막 하이라이트가 페이지 전체를 스크롤해 영상이 흔들리던 문제

재생 중 활성 세그먼트로 이동할 때 scrollIntoView가 페이지를 스크롤해 sticky 영상이
위아래로 튀던 현상 수정. 세그먼트 박스(#segmentList) 내부에서만 스크롤하도록 변경.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
hehihoho3@gmail.com 2026-06-25 18:25:41 +09:00
parent 31b7720af9
commit 99dbe80fdb

View File

@ -420,7 +420,15 @@
rows.forEach(r=>{
const on = Number(r.dataset.i)===activeIdx;
r.classList.toggle('active', on);
if(on) r.scrollIntoView({block:'nearest'});
if(on){
// 페이지 전체가 아니라 세그먼트 박스 안에서만 스크롤(영상 sticky 흔들림 방지)
const box = document.getElementById('segmentList');
if(box){
const br = box.getBoundingClientRect(), rr = r.getBoundingClientRect();
if(rr.top < br.top) box.scrollTop -= (br.top - rr.top);
else if(rr.bottom > br.bottom) box.scrollTop += (rr.bottom - br.bottom);
}
}
});
}