actually, pass in just the tile instances for expressing the range

This commit is contained in:
Bruno Windels 2021-09-07 19:10:53 +02:00
parent b3cd2a0e03
commit f4b4638ea8
5 changed files with 2 additions and 13 deletions

View file

@ -45,8 +45,7 @@ export class TimelineViewModel extends ViewModel {
this._timeline.loadAtTop(50); this._timeline.loadAtTop(50);
} }
setVisibleTileRange(startId, endId) { setVisibleTileRange(startTile, endTile) {
console.log("setVisibleTileRange", startId, endId);
} }
get tiles() { get tiles() {

View file

@ -119,7 +119,6 @@ export class TimelineView extends TemplateView<TimelineViewModel> {
const viewportBottom = scrollTop + clientHeight; const viewportBottom = scrollTop + clientHeight;
const anchoredNodeIndex = findFirstNodeIndexAtOrBelow(tiles, viewportBottom); const anchoredNodeIndex = findFirstNodeIndexAtOrBelow(tiles, viewportBottom);
this.anchoredNode = tiles.childNodes[anchoredNodeIndex] as HTMLElement; this.anchoredNode = tiles.childNodes[anchoredNodeIndex] as HTMLElement;
this.anchoredNode.classList.add("pinned");
this.anchoredBottom = bottom(this.anchoredNode!); this.anchoredBottom = bottom(this.anchoredNode!);
bottomNodeIndex = anchoredNodeIndex; bottomNodeIndex = anchoredNodeIndex;
} }
@ -131,7 +130,7 @@ export class TimelineView extends TemplateView<TimelineViewModel> {
const firstVisibleChild = this.tilesView!.getChildInstanceByIndex(startIndex); const firstVisibleChild = this.tilesView!.getChildInstanceByIndex(startIndex);
const lastVisibleChild = this.tilesView!.getChildInstanceByIndex(endIndex); const lastVisibleChild = this.tilesView!.getChildInstanceByIndex(endIndex);
if (firstVisibleChild && lastVisibleChild) { if (firstVisibleChild && lastVisibleChild) {
this.value.setVisibleTileRange(firstVisibleChild.id, lastVisibleChild.id); this.value.setVisibleTileRange(firstVisibleChild.value, lastVisibleChild.value);
} }
} }
} }

View file

@ -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 */ /* This is called by the parent ListView, which just has 1 listener for the whole list */
onClick() {} onClick() {}
/** Used by TimelineView to get the id of a tile when setting the visible range */
get id() { return this.value.id; }
} }

View file

@ -86,9 +86,6 @@ export class BaseMessageView extends TemplateView {
} }
} }
/** Used by TimelineView to get the id of a tile when setting the visible range */
get id() { return this.value.id; }
_toggleMenu(button) { _toggleMenu(button) {
if (this._menuPopup && this._menuPopup.isOpen) { if (this._menuPopup && this._menuPopup.isOpen) {
this._menuPopup.close(); this._menuPopup.close();

View file

@ -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 */ /* This is called by the parent ListView, which just has 1 listener for the whole list */
onClick() {} onClick() {}
/** Used by TimelineView to get the id of a tile when setting the visible range */
get id() { return this.value.id; }
} }