mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-17 05:55:00 +08:00
clearer naming in ScrollPanel
This commit is contained in:
parent
4e382b1dd9
commit
89b044f5d8
@ -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 New Issue
Block a user