Bugfix: don't cache the read avatar rect as it's relative to the viewport and it will move when we scroll!

This commit is contained in:
David Baker 2015-11-20 16:01:51 +00:00
parent 6dc5dd4930
commit 2c51a5c199

View File

@ -71,7 +71,7 @@ module.exports = React.createClass({
}, },
componentDidUpdate: function() { componentDidUpdate: function() {
this.readAvatarRect = ReactDom.findDOMNode(this.readAvatarNode).getBoundingClientRect(); this.readAvatarNode = ReactDom.findDOMNode(this.readAvatarNode);
}, },
onEditClicked: function(e) { onEditClicked: function(e) {
@ -136,8 +136,8 @@ module.exports = React.createClass({
oldNodeTop = oldAvatarDomNode.getBoundingClientRect().top; oldNodeTop = oldAvatarDomNode.getBoundingClientRect().top;
} }
if (this.readAvatarRect) { if (this.readAvatarNode) {
var topOffset = oldNodeTop - this.readAvatarRect.top; var topOffset = oldNodeTop - this.readAvatarNode.getBoundingClientRect().top;
if (oldAvatarDomNode && oldAvatarDomNode.style.left !== '0px') { if (oldAvatarDomNode && oldAvatarDomNode.style.left !== '0px') {
var leftOffset = oldAvatarDomNode.style.left; var leftOffset = oldAvatarDomNode.style.left;