src/utils.js
function toGlobalCoordinates(svgdoc: any, elem: any, x: number, y: number) {
    var offset = svgdoc.getBoundingClientRect();
    var matrix = elem.getScreenCTM();
    return {
      x: matrix.a * x + matrix.c * y + matrix.e - offset.left,
      y: matrix.b * x + matrix.d * y + matrix.f - offset.top
    };
  }
function toGlobalCoordinates(svgdoc: any, elem: any, x: number, y: number) {
    var offset = svgdoc.getBoundingClientRect();
    var matrix = elem.getScreenCTM();
    return {
      x: matrix.a * x + matrix.c * y + matrix.e - offset.left,
      y: matrix.b * x + matrix.d * y + matrix.f - offset.top
    };
  }
Note on viewbox/width
This methods only work when the pixels match the svg units.
when the viewbox is changed, or width is set they won't return
the correct results
 
Returns the global coordinates of a position given
for a specific coordinate system
@param {*} svgdoc
@param {*} elem
@param {*} x
@param {*} y