fill top gap instead of loading more events from storage

This commit is contained in:
Bruno Windels 2020-08-17 15:13:12 +02:00
parent cf0af775e3
commit 1e4f331989
2 changed files with 10 additions and 1 deletions

View File

@ -201,6 +201,10 @@ export class TilesCollection extends BaseObservableList {
get length() { get length() {
return this._tiles.length; return this._tiles.length;
} }
getFirst() {
return this._tiles[0];
}
} }
import {ObservableArray} from "../../../../observable/list/ObservableArray.js"; import {ObservableArray} from "../../../../observable/list/ObservableArray.js";

View File

@ -44,8 +44,13 @@ export class TimelineViewModel {
// doesn't fill gaps, only loads stored entries/tiles // doesn't fill gaps, only loads stored entries/tiles
loadAtTop() { loadAtTop() {
const firstTile = this._tiles.getFirst();
if (firstTile.shape === "gap") {
return firstTile.fill();
} else {
return this._timeline.loadAtTop(50); return this._timeline.loadAtTop(50);
} }
}
unloadAtTop(tileAmount) { unloadAtTop(tileAmount) {
// get lowerSortKey for tile at index tileAmount - 1 // get lowerSortKey for tile at index tileAmount - 1