feat: improve smooth scrolling behavior in ChaptersPanel by adjusting scroll position calculation
This commit is contained in:
@@ -1455,7 +1455,8 @@ function ChaptersPanel({
|
||||
const el = document.getElementById(`ch-${scrollToChapterId}`)
|
||||
const container = scrollContainerRef.current
|
||||
if (el && container) {
|
||||
container.scrollTo({ top: el.offsetTop, behavior: 'smooth' })
|
||||
const top = el.getBoundingClientRect().top - container.getBoundingClientRect().top + container.scrollTop
|
||||
container.scrollTo({ top, behavior: 'smooth' })
|
||||
}
|
||||
onScrollToChapterDone()
|
||||
}, [scrollToChapterId, onScrollToChapterDone])
|
||||
|
||||
Reference in New Issue
Block a user