diff --git a/src/components/chart_resizer.tsx b/src/components/chart_resizer.tsx index 2414333046..6a91962460 100644 --- a/src/components/chart_resizer.tsx +++ b/src/components/chart_resizer.tsx @@ -26,10 +26,8 @@ class Resizer extends React.Component { } onResize = (entries: ResizeObserverEntry[]) => { - entries.forEach((entry) => { - const { width, height } = entry.contentRect; - const { top, left } = entry.target.getBoundingClientRect(); - this.props.chartStore!.updateParentDimensions(width, height, top, left); + entries.forEach(({ contentRect: { width, height } }) => { + this.props.chartStore!.updateParentDimensions(width, height, 0, 0); }); } diff --git a/src/components/react_canvas/reactive_chart.tsx b/src/components/react_canvas/reactive_chart.tsx index e8442f00d8..5cdbbd1825 100644 --- a/src/components/react_canvas/reactive_chart.tsx +++ b/src/components/react_canvas/reactive_chart.tsx @@ -278,12 +278,8 @@ class Chart extends React.Component { left: 0, boxSizing: 'border-box', }} - onMouseMove={({ clientX, clientY }) => { - // this cause a layout reflow on the browser https://gist.github.com/paulirish/5d52fb081b3570c81e3a - const { left, top } = this.props.chartStore!.parentDimensions; - const x = clientX - left; - const y = clientY - top; - setCursorPosition(x, y); + onMouseMove={({ nativeEvent: { offsetX, offsetY } }) => { + setCursorPosition(offsetX, offsetY); }} onMouseLeave={() => { setCursorPosition(-1, -1);