private onChangeHandler()

in src/app/common/virtual-list.component.ts [142:176]


    private onChangeHandler() {
        if (this.list || this.count != -1) {
            this._screenHeight = window.innerHeight - this._navHeight;
            this._totalHeight = this.count * this._elementHeight;
            this._listSize = this._screenHeight + this._bufferSize * this._elementHeight;
            this._scrollTop = this.scrollTop;
            this._preHeight = this.preHeight;
            this._postHeight = this.postHeight;

            let startIndex = Math.floor(this._preHeight / this._elementHeight);
            let length = Math.floor(this._listSize / this._elementHeight);

            if (!this._heightKnown) {
                length = Math.min(length, this._unknownMax);
            }

            this._changeDetector.markForCheck();

            if (this._prevStart != startIndex || this._prevLength != length || this._dirty) {
                this._dirty = false;
                this._prevLength = length;
                this._prevStart = startIndex;

                if (this.rangeChange) {
                    this.rangeChange.next(new Range(startIndex, length));
                }

                if (this.list) {
                    this._filtered.next(this.list.filter((f, i) => {
                        return i >= startIndex && i < startIndex + length;
                    }));
                }
            }
        }
    }