List infinite scroll now always works

- before sometimes list scrolling stopped even the spinner was visible
  and scrolling was at the end of the list
This commit is contained in:
Martin Filser 2021-04-26 18:48:27 +02:00
parent ac3d658cb1
commit 4f9d3d8be5

View file

@ -770,16 +770,21 @@ BlazeComponent.extendComponent({
},
spinnerInView() {
const parentViewHeight = this.container.clientHeight;
const bottomViewPosition = this.container.scrollTop + parentViewHeight;
const threshold = this.spinner.offsetTop;
// spinner deleted
if (!this.spinner.offsetTop) {
return false;
}
return bottomViewPosition > threshold;
const parentViewHeight = this.container.clientHeight;
const bottomViewPosition = this.container.scrollTop + parentViewHeight;
let spinnerOffsetTop = this.spinner.offsetTop;
const addCard = $(this.container).find("a.open-minicard-composer").first()[0];
if (addCard !== undefined) {
spinnerOffsetTop -= addCard.clientHeight;
}
return bottomViewPosition > spinnerOffsetTop;
},
}).register('spinnerList');