From 7ae821e2b552f57e5c787388cc8eed1f2447f609 Mon Sep 17 00:00:00 2001 From: wmwragg Date: Sun, 4 Sep 2016 08:39:32 +0100 Subject: [PATCH] Removed nolonger needed conditional test, as the parent will always exist --- src/components/views/rooms/RoomTooltip.js | 38 +++++++++++------------ 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/src/components/views/rooms/RoomTooltip.js b/src/components/views/rooms/RoomTooltip.js index 7dca627a..9ee58401 100644 --- a/src/components/views/rooms/RoomTooltip.js +++ b/src/components/views/rooms/RoomTooltip.js @@ -69,33 +69,31 @@ module.exports = React.createClass({ if (this.props.left) { style.left = this.props.left; } if (this.props.right) { style.right = this.props.right; } - // If a parent exists, add the parent's position to the tooltips, so it's correctly + // 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; - if (parent) { - style.top = (+style.top || 0) + parent.getBoundingClientRect().top + window.pageYOffset; - style.left = (+style.left || 0) + 6 + parent.getBoundingClientRect().right + window.pageXOffset; - style.display = "block"; + style.top = (+style.top || 0) + parent.getBoundingClientRect().top + window.pageYOffset; + style.left = (+style.left || 0) + 6 + parent.getBoundingClientRect().right + window.pageXOffset; + style.display = "block"; - var tooltip = ( -
-
- { label } -
- ); + var tooltip = ( +
+
+ { label } +
+ ); - // Render the tooltip manually, as we wish it not to be rendered within the parent - this.tooltip = ReactDOM.render(tooltip, this.tooltipContainer); + // Render the tooltip manually, as we wish it not to be rendered within the parent + this.tooltip = ReactDOM.render(tooltip, this.tooltipContainer); - // tell the roomlist about us so it can manipulate us if it wishes - dis.dispatch({ - action: 'view_tooltip', - tooltip: this.tooltip, - parent: parent, - }); - } + // tell the roomlist about us so it can manipulate us if it wishes + dis.dispatch({ + action: 'view_tooltip', + tooltip: this.tooltip, + parent: parent, + }); }, render: function() {