padding needs to be on ul, not scroll container, or the list blows up

This commit is contained in:
Bruno Windels 2021-11-23 14:25:35 +01:00
parent 4be2f12a14
commit 9557178ffb

View file

@ -131,7 +131,7 @@ export class LazyListView<T, V extends IView> extends ListView<T, V> {
private adjustPadding(range: ListRange) { private adjustPadding(range: ListRange) {
const paddingTop = range.start * this.itemHeight; const paddingTop = range.start * this.itemHeight;
const paddingBottom = (range.totalLength - range.end) * this.itemHeight; const paddingBottom = (range.totalLength - range.end) * this.itemHeight;
const style = this.scrollContainer!.style; const style = this._listElement!.style;
style.paddingTop = `${paddingTop}px`; style.paddingTop = `${paddingTop}px`;
style.paddingBottom = `${paddingBottom}px`; style.paddingBottom = `${paddingBottom}px`;
} }
@ -153,8 +153,8 @@ export class LazyListView<T, V extends IView> extends ListView<T, V> {
return this.scrollContainer; return this.scrollContainer;
} }
private get _listElement(): Element | undefined { private get _listElement(): HTMLElement | undefined {
return super.root(); return super.root() as HTMLElement | undefined;
} }
onAdd(idx: number, value: T) { onAdd(idx: number, value: T) {