Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private adjustPosition() {
const { cell } = this.state;
const el = ReactDOM.findDOMNode(this.refs.tooltip) as any;
const { positionalParent, parent } = tooltipHelper(el, cell);
if (!positionalParent || !parent || !el) {
return;
}
const positionalBounds = positionalParent.getBoundingClientRect();
const parentBounds = parent.getBoundingClientRect();
const { clientWidth: elWidth, clientHeight: elHeight } = el;
const elAnchorHeight = Math.max(
parseFloat(getComputedStyle(el, ':before').borderWidth || '0'),
parseFloat(getComputedStyle(el, ':after').borderWidth || '0')
);
const leftCorrection = (parentBounds.width - elWidth) / 2;
let left = (parentBounds.left - positionalBounds.left) + positionalParent.scrollLeft + leftCorrection;