mirror of https://github.com/vector-im/riot-web
fix filling conditions
parent
f2f3661b7e
commit
5d53913e35
|
@ -317,17 +317,20 @@ module.exports = React.createClass({
|
||||||
this._isFilling = true;
|
this._isFilling = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const itemlist = this.refs.itemlist;
|
||||||
const contentHeight = this._getMessagesHeight();
|
const firstTile = itemlist && itemlist.firstElementChild;
|
||||||
const contentTop = contentHeight - this._getListHeight();
|
const contentTop = firstTile && firstTile.offsetTop;
|
||||||
const contentScrollTop = sn.scrollTop + contentTop;
|
|
||||||
const fillPromises = [];
|
const fillPromises = [];
|
||||||
|
|
||||||
if (contentScrollTop < sn.clientHeight) {
|
// if scrollTop gets to 1 screen from the top of the first tile,
|
||||||
|
// try backward filling
|
||||||
|
if (!firstTile || (sn.scrollTop - contentTop) < sn.clientHeight) {
|
||||||
// need to back-fill
|
// need to back-fill
|
||||||
fillPromises.push(this._maybeFill(depth, true));
|
fillPromises.push(this._maybeFill(depth, true));
|
||||||
}
|
}
|
||||||
if (contentScrollTop > contentHeight - sn.clientHeight * 2) {
|
// if scrollTop gets to 2 screens from the end (so 1 screen below viewport),
|
||||||
|
// try forward filling
|
||||||
|
if ((sn.scrollHeight - sn.scrollTop) < sn.clientHeight * 2) {
|
||||||
// need to forward-fill
|
// need to forward-fill
|
||||||
fillPromises.push(this._maybeFill(depth, false));
|
fillPromises.push(this._maybeFill(depth, false));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue