From 247d6a2148693611958a0420930bbb2a0263e88d Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Tue, 14 Sep 2021 17:01:30 +0200 Subject: [PATCH] add comments --- src/platform/web/ui/session/room/TimelineView.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/platform/web/ui/session/room/TimelineView.ts b/src/platform/web/ui/session/room/TimelineView.ts index f9e0b63d..9bcfb333 100644 --- a/src/platform/web/ui/session/room/TimelineView.ts +++ b/src/platform/web/ui/session/room/TimelineView.ts @@ -101,6 +101,9 @@ export class TimelineView extends TemplateView { if (newAnchoredBottom !== this.anchoredBottom) { const bottomDiff = newAnchoredBottom - this.anchoredBottom; console.log(`restore: scroll by ${bottomDiff} as height changed`); + // scrollBy tends to create less scroll jumps than reassigning scrollTop as it does + // not depend on reading scrollTop, which might be out of date as some platforms + // run scrolling off the main thread. if (typeof timeline.scrollBy === "function") { timeline.scrollBy(0, bottomDiff); } else { @@ -111,6 +114,8 @@ export class TimelineView extends TemplateView { // console.log("restore: bottom didn't change, must be below viewport"); } } + // TODO: should we be updating the visible range here as well as the range might have changed even though + // we restored the bottom tile } }