mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 03:25:12 +01:00
actually, pass in just the tile instances for expressing the range
This commit is contained in:
parent
b3cd2a0e03
commit
f4b4638ea8
@ -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() {
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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; }
|
|
||||||
}
|
}
|
||||||
|
@ -85,9 +85,6 @@ export class BaseMessageView extends TemplateView {
|
|||||||
this._toggleMenu(evt.target);
|
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) {
|
_toggleMenu(button) {
|
||||||
if (this._menuPopup && this._menuPopup.isOpen) {
|
if (this._menuPopup && this._menuPopup.isOpen) {
|
||||||
|
@ -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; }
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user