fix(tooltip): remove redundant scroll offset

window.scrollY is already account for which means document.body.scrollTop incorrectly offsets the tooltip vertically.
The same is not true for horizontal position.
This commit is contained in:
Sebastian Holmqvist 2023-10-19 17:01:43 +02:00
parent 77667b94d3
commit 8f2a5064cb

View File

@ -425,7 +425,7 @@ const setupToolTips = function (element) {
tooltipElem
.text(el.attr('title'))
.style('left', window.scrollX + rect.left + (rect.right - rect.left) / 2 + 'px')
.style('top', window.scrollY + rect.top - 14 + document.body.scrollTop + 'px');
.style('top', window.scrollY + rect.top - 14 + 'px');
tooltipElem.html(tooltipElem.html().replace(/&lt;br\/&gt;/g, '<br/>'));
el.classed('hover', true);
})