mirror of
https://github.com/SchildiChat/element-web.git
synced 2024-10-01 01:26:12 -04:00
Small refactor, to make it clearer whats happening
This commit is contained in:
parent
e52f5b5d08
commit
50bb4edd1c
@ -60,19 +60,21 @@ module.exports = React.createClass({
|
||||
|
||||
_renderTooltip: function() {
|
||||
var label = this.props.room ? this.props.room.name : this.props.label;
|
||||
var style = {};
|
||||
if (this.props.top) { style.top = this.props.top; }
|
||||
if (this.props.left) { style.left = this.props.left; }
|
||||
|
||||
// Add the parent's position to the tooltips, so it's correctly
|
||||
// positioned, also taking into account any window zoom
|
||||
// NOTE: The additional 6 pixels for the left position, is to take account of the
|
||||
// tooltips chevron
|
||||
var parent = ReactDOM.findDOMNode(this).parentElement;
|
||||
style.top = (+style.top || 0) + parent.getBoundingClientRect().top + window.pageYOffset;
|
||||
style.left = (+style.left || 0) + 6 + parent.getBoundingClientRect().right + window.pageXOffset;
|
||||
var style = {};
|
||||
style.top = parent.getBoundingClientRect().top + window.pageYOffset;
|
||||
style.left = 6 + parent.getBoundingClientRect().right + window.pageXOffset;
|
||||
style.display = "block";
|
||||
|
||||
// Add any additional positional tweaks passed in to the tooltip
|
||||
if (this.props.top) { style.top += this.props.top; }
|
||||
if (this.props.left) { style.left += this.props.left; }
|
||||
|
||||
var tooltip = (
|
||||
<div className="mx_RoomTooltip" style={style} >
|
||||
<div className="mx_RoomTooltip_chevron"></div>
|
||||
|
Loading…
Reference in New Issue
Block a user