@guardian/interactive-component-library 0.1.0-alpha.10 → 0.1.0-alpha.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1606,18 +1606,17 @@
1606
1606
  }) : tooltip2, displayElement);
1607
1607
  }
1608
1608
  function tooltipPositionForPoint({
1609
- targetRect,
1610
1609
  positionInTarget,
1611
1610
  tooltip: tooltip2,
1612
1611
  displayElement
1613
1612
  }) {
1613
+ const displayElementRect = displayElement.getBoundingClientRect();
1614
1614
  const newPosition = {
1615
- x: positionInTarget.x + targetRect.x,
1616
- y: positionInTarget.y + targetRect.y
1615
+ x: positionInTarget.x + displayElementRect.x,
1616
+ y: positionInTarget.y + displayElementRect.y
1617
1617
  };
1618
1618
  const tooltipWidth = tooltip2.offsetWidth;
1619
1619
  const tooltipHeight = tooltip2.offsetHeight;
1620
- const displayElementRect = displayElement.getBoundingClientRect();
1621
1620
  if (newPosition.x + tooltipWidth > displayElementRect.right) {
1622
1621
  newPosition.x -= tooltipWidth;
1623
1622
  }