@mocanvas/editor · function

getPointerInfo

declare function getPointerInfo(event: PointerEvent | MouseEvent, container?: Element | null): TLPointerInfo

Read a browser pointer event into the fields the editor's dispatch loop wants, in the coordinate space of container.

The container is explicit rather than inferred from event.currentTarget because the listener is usually on an outer element while coordinates have to be relative to the canvas itself, and because a synthetic React event's currentTarget is null by the time an async handler looks at it.

mocanvas is built by Symbio. Free for non-commercial, non-profit and development use; commercial use needs an agreement. Not affiliated with or endorsed by tldraw.