Files
Iliyan Angelov 306b20e24a Frontend start
2025-09-14 00:54:48 +03:00

17 lines
440 B
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getSVGPoint = getSVGPoint;
/**
* Transform mouse event position to coordinates inside the SVG.
* @param svg The SVG element
* @param event The mouseEvent to transform
*/
function getSVGPoint(svg, event) {
const pt = svg.createSVGPoint();
pt.x = event.clientX;
pt.y = event.clientY;
return pt.matrixTransform(svg.getScreenCTM().inverse());
}