mirror of
https://github.com/element-hq/element-web
synced 2024-11-22 17:25:50 +03:00
clearer naming in ScrollPanel
This commit is contained in:
parent
4e382b1dd9
commit
89b044f5d8
1 changed files with 9 additions and 8 deletions
|
@ -601,16 +601,17 @@ module.exports = React.createClass({
|
|||
}
|
||||
|
||||
const scrollNode = this._getScrollNode();
|
||||
const scrollBottom = scrollNode.scrollTop + scrollNode.clientHeight;
|
||||
|
||||
const scrollTop = scrollNode.scrollTop;
|
||||
const viewportBottom = scrollTop + scrollNode.clientHeight;
|
||||
const nodeBottom = node.offsetTop + node.clientHeight;
|
||||
const scrollDelta = nodeBottom + pixelOffset - scrollBottom;
|
||||
const intendedViewportBottom = nodeBottom + pixelOffset;
|
||||
const scrollDelta = intendedViewportBottom - viewportBottom;
|
||||
|
||||
debuglog("ScrollPanel: scrolling to token '" + scrollToken + "'+" +
|
||||
pixelOffset + " (delta: "+scrollDelta+")");
|
||||
|
||||
if (scrollDelta != 0) {
|
||||
this._setScrollTop(scrollNode.scrollTop + scrollDelta);
|
||||
if (scrollDelta !== 0) {
|
||||
this._setScrollTop(scrollTop + scrollDelta);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -622,7 +623,7 @@ module.exports = React.createClass({
|
|||
}
|
||||
|
||||
const scrollNode = this._getScrollNode();
|
||||
const scrollBottom = scrollNode.scrollTop + scrollNode.clientHeight;
|
||||
const viewportBottom = scrollNode.scrollTop + scrollNode.clientHeight;
|
||||
|
||||
const itemlist = this.refs.itemlist;
|
||||
const messages = itemlist.children;
|
||||
|
@ -636,7 +637,7 @@ module.exports = React.createClass({
|
|||
node = messages[i];
|
||||
// break at the first message (coming from the bottom)
|
||||
// that has it's offsetTop above the bottom of the viewport.
|
||||
if (node.offsetTop < scrollBottom) {
|
||||
if (node.offsetTop < viewportBottom) {
|
||||
// Use this node as the scrollToken
|
||||
break;
|
||||
}
|
||||
|
@ -652,7 +653,7 @@ module.exports = React.createClass({
|
|||
this.scrollState = {
|
||||
stuckAtBottom: false,
|
||||
trackedScrollToken: node.dataset.scrollTokens.split(',')[0],
|
||||
pixelOffset: scrollBottom - nodeBottom,
|
||||
pixelOffset: viewportBottom - nodeBottom,
|
||||
};
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in a new issue