fix status index approxmiation in timeline rendering for dynamically changing viewport geometries

This commit is contained in:
Alexander Tumin 2026-08-01 23:36:31 +03:00
commit 58fdd50838
2 changed files with 5 additions and 1 deletions

View file

@ -0,0 +1 @@
Fixed status index approxmiation in timeline rendering for dynamically changing viewport geometries

View file

@ -263,7 +263,10 @@ const Timeline = {
// Start from approximating the index of some visible status by using the
// the center of the screen on the timeline.
let approxIndex = Math.floor(statuses.length * (centerOfScreen / height))
let approxIndex = Math.min(
Math.floor(statuses.length * (centerOfScreen / height)),
statuses.length - 1,
)
let err = statuses[approxIndex].getBoundingClientRect().y
// if we have a previous scroll index that can be used, test if it's