Skip to main content

blockly > utils > browserEvents > mouseToSvg

utils.browserEvents.mouseToSvg() function

Returns the converted coordinates of the given mouse event. The origin (0,0) is the top-left corner of the Blockly SVG.

Signature:

export declare function mouseToSvg(e: MouseEvent, svg: SVGSVGElement, matrix: SVGMatrix | null): SVGPoint;

Parameters

Parameter

Type

Description

e

MouseEvent

Mouse event.

svg

SVGSVGElement

SVG element.

matrix

SVGMatrix | null

Inverted screen CTM to use.

Returns:

SVGPoint

Object with .x and .y properties.