Refactor of the RoomTooltip, so that it is easier to use, and also works with Safari
This commit is contained in:
parent
e7d4ef74d0
commit
4c05edb71b
2 changed files with 5 additions and 6 deletions
|
@ -77,6 +77,7 @@ module.exports = React.createClass({
|
||||||
switch (payload.action) {
|
switch (payload.action) {
|
||||||
case 'view_tooltip':
|
case 'view_tooltip':
|
||||||
this.tooltip = payload.tooltip;
|
this.tooltip = payload.tooltip;
|
||||||
|
this.tooltipParent = payload.parent;
|
||||||
this._repositionTooltip();
|
this._repositionTooltip();
|
||||||
if (this.tooltip) this.tooltip.style.display = 'block';
|
if (this.tooltip) this.tooltip.style.display = 'block';
|
||||||
break;
|
break;
|
||||||
|
@ -275,11 +276,9 @@ module.exports = React.createClass({
|
||||||
},
|
},
|
||||||
|
|
||||||
_repositionTooltip: function(e) {
|
_repositionTooltip: function(e) {
|
||||||
// We access the parent of the parent, as the tooltip is inside a container
|
if (this.tooltip && this.tooltipParent) {
|
||||||
// Needs refactoring into a better multipurpose tooltip
|
this.tooltip.style.top = this.tooltipParent.getBoundingClientRect().top + "px";
|
||||||
if (this.tooltip && this.tooltip.parentElement && this.tooltip.parentElement.parentElement) {
|
this.tooltip.style.left = this.tooltipParent.getBoundingClientRect().right + "px";
|
||||||
var scroll = ReactDOM.findDOMNode(this);
|
|
||||||
this.tooltip.style.top = (3 + scroll.parentElement.offsetTop + this.tooltip.parentElement.parentElement.offsetTop - this._getScrollNode().scrollTop) + "px";
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -248,7 +248,7 @@ module.exports = React.createClass({
|
||||||
}
|
}
|
||||||
else if (this.state.hover) {
|
else if (this.state.hover) {
|
||||||
var RoomTooltip = sdk.getComponent("rooms.RoomTooltip");
|
var RoomTooltip = sdk.getComponent("rooms.RoomTooltip");
|
||||||
label = <RoomTooltip room={this.props.room}/>;
|
label = <RoomTooltip room={this.props.room} component={this} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
var incomingCallBox;
|
var incomingCallBox;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue