UNPKG

@mui/x-charts

Version:

The community edition of the Charts components (MUI X).

11 lines 332 B
/** * Transform mouse event position to coordinates inside the SVG. * @param svg The SVG element * @param event The mouseEvent to transform */ export function getSVGPoint(svg, event) { const pt = svg.createSVGPoint(); pt.x = event.clientX; pt.y = event.clientY; return pt.matrixTransform(svg.getScreenCTM().inverse()); }