Further tweaks to the tooltip to better handle its position, and simplify it's use

pull/21833/head
wmwragg 2016-09-03 12:44:55 +01:00
parent bffefd9261
commit 405dcf76eb
2 changed files with 6 additions and 13 deletions

View File

@ -77,9 +77,6 @@ module.exports = React.createClass({
switch (payload.action) {
case 'view_tooltip':
this.tooltip = payload.tooltip;
this.tooltipParent = payload.parent;
this._repositionTooltip();
if (this.tooltip) this.tooltip.style.display = 'block';
break;
case 'call_state':
var call = CallHandler.getCall(payload.room_id);
@ -270,15 +267,15 @@ module.exports = React.createClass({
},
_whenScrolling: function(e) {
this._repositionTooltip(e);
this._hideTooltip(e);
this._repositionIncomingCallBox(e, false);
this._updateStickyHeaders(false);
},
_repositionTooltip: function(e) {
if (this.tooltip && this.tooltipParent) {
this.tooltip.style.top = this.tooltipParent.getBoundingClientRect().top + "px";
this.tooltip.style.left = this.tooltipParent.getBoundingClientRect().right + "px";
_hideTooltip: function(e) {
// Hide tooltip when scrolling, as we'll no longer be over the one we were on
if (this.tooltip && this.tooltip.style.display !== "none") {
this.tooltip.style.display = "none";
}
},

View File

@ -76,10 +76,6 @@ module.exports = React.createClass({
MatrixClientPeg.get().on("accountData", this.onAccountData);
},
componentDidMount: function() {
this.componentElement = ReactDOM.findDOMNode(this);
},
componentWillUnmount: function() {
var cli = MatrixClientPeg.get();
if (cli) {
@ -253,7 +249,7 @@ module.exports = React.createClass({
}
else if (this.state.hover) {
var RoomTooltip = sdk.getComponent("rooms.RoomTooltip");
label = <RoomTooltip room={this.props.room} parent={this.componentElement} />;
label = <RoomTooltip room={this.props.room} parent={this} />;
}
var incomingCallBox;