getEventCoordinates
Commons
stable
Extracts {clientX, clientY} from a MouseEvent or TouchEvent in a unified way. For touch events, the coordinates of the first touch point are returned.
API
Signature
Full TypeScript signature sourced from the util file.
API
Parameters
Input parameters accepted by this util.
- erequiredMouseEvent | TouchEvent
- The pointer event. Touch events use e.touches[0]; mouse events use e.clientX / e.clientY directly.
API
Return value
The value returned by this util.
- Object with clientX and clientY in viewport pixels, normalised across mouse and touch input.
Usage
Examples
Ready-to-paste usage snippets.
Normalise pointer position