From f4b4638ea8a2faad2e28c6a382255cb1a477bdfa Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Tue, 7 Sep 2021 19:10:53 +0200 Subject: [PATCH] actually, pass in just the tile instances for expressing the range --- src/domain/session/room/timeline/TimelineViewModel.js | 3 +-- src/platform/web/ui/session/room/TimelineView.ts | 3 +-- src/platform/web/ui/session/room/timeline/AnnouncementView.js | 3 --- src/platform/web/ui/session/room/timeline/BaseMessageView.js | 3 --- src/platform/web/ui/session/room/timeline/GapView.js | 3 --- 5 files changed, 2 insertions(+), 13 deletions(-) diff --git a/src/domain/session/room/timeline/TimelineViewModel.js b/src/domain/session/room/timeline/TimelineViewModel.js index c4c428d6..dd115e79 100644 --- a/src/domain/session/room/timeline/TimelineViewModel.js +++ b/src/domain/session/room/timeline/TimelineViewModel.js @@ -45,8 +45,7 @@ export class TimelineViewModel extends ViewModel { this._timeline.loadAtTop(50); } - setVisibleTileRange(startId, endId) { - console.log("setVisibleTileRange", startId, endId); + setVisibleTileRange(startTile, endTile) { } get tiles() { diff --git a/src/platform/web/ui/session/room/TimelineView.ts b/src/platform/web/ui/session/room/TimelineView.ts index 2faad17c..969cd254 100644 --- a/src/platform/web/ui/session/room/TimelineView.ts +++ b/src/platform/web/ui/session/room/TimelineView.ts @@ -119,7 +119,6 @@ export class TimelineView extends TemplateView { const viewportBottom = scrollTop + clientHeight; const anchoredNodeIndex = findFirstNodeIndexAtOrBelow(tiles, viewportBottom); this.anchoredNode = tiles.childNodes[anchoredNodeIndex] as HTMLElement; - this.anchoredNode.classList.add("pinned"); this.anchoredBottom = bottom(this.anchoredNode!); bottomNodeIndex = anchoredNodeIndex; } @@ -131,7 +130,7 @@ export class TimelineView extends TemplateView { const firstVisibleChild = this.tilesView!.getChildInstanceByIndex(startIndex); const lastVisibleChild = this.tilesView!.getChildInstanceByIndex(endIndex); if (firstVisibleChild && lastVisibleChild) { - this.value.setVisibleTileRange(firstVisibleChild.id, lastVisibleChild.id); + this.value.setVisibleTileRange(firstVisibleChild.value, lastVisibleChild.value); } } } diff --git a/src/platform/web/ui/session/room/timeline/AnnouncementView.js b/src/platform/web/ui/session/room/timeline/AnnouncementView.js index c7f47073..2dd58b32 100644 --- a/src/platform/web/ui/session/room/timeline/AnnouncementView.js +++ b/src/platform/web/ui/session/room/timeline/AnnouncementView.js @@ -23,7 +23,4 @@ export class AnnouncementView extends TemplateView { /* This is called by the parent ListView, which just has 1 listener for the whole list */ onClick() {} - - /** Used by TimelineView to get the id of a tile when setting the visible range */ - get id() { return this.value.id; } } diff --git a/src/platform/web/ui/session/room/timeline/BaseMessageView.js b/src/platform/web/ui/session/room/timeline/BaseMessageView.js index 8f6fa22f..9469d201 100644 --- a/src/platform/web/ui/session/room/timeline/BaseMessageView.js +++ b/src/platform/web/ui/session/room/timeline/BaseMessageView.js @@ -85,9 +85,6 @@ export class BaseMessageView extends TemplateView { this._toggleMenu(evt.target); } } - - /** Used by TimelineView to get the id of a tile when setting the visible range */ - get id() { return this.value.id; } _toggleMenu(button) { if (this._menuPopup && this._menuPopup.isOpen) { diff --git a/src/platform/web/ui/session/room/timeline/GapView.js b/src/platform/web/ui/session/room/timeline/GapView.js index 0055d72c..afd22bd3 100644 --- a/src/platform/web/ui/session/room/timeline/GapView.js +++ b/src/platform/web/ui/session/room/timeline/GapView.js @@ -32,7 +32,4 @@ export class GapView extends TemplateView { /* This is called by the parent ListView, which just has 1 listener for the whole list */ onClick() {} - - /** Used by TimelineView to get the id of a tile when setting the visible range */ - get id() { return this.value.id; } }