The PointerEvent interface represents the state of a DOM event produced by a pointer such as the geometry of the contact point, the device type that generated the event, the amount of pressure that was applied on the contact surface, etc.
A pointer is a hardware agnostic representation of input devices (such as a mouse, pen or contact point on a touch-enable surface). The pointer can target a specific coordinate (or set of coordinates) on the contact surface such as a screen.
A pointer's hit test is the process a browser uses to determine the target element for a pointer event. Typically, this is determined by considering the pointer's location and also the visual layout of elements in a document on screen media.
PointerEvent()This interface inherits properties from MouseEvent and Event.
PointerEvent.pointerId Read only
PointerEvent.width Read only
PointerEvent.height Read only
PointerEvent.pressure Read only
PointerEvent.tangentialPressure Read only
PointerEvent.tiltX Read only
PointerEvent.tiltY Read only
PointerEvent.twist Read only
PointerEvent.pointerType Read only
PointerEvent.isPrimary Read only
PointerEvent.getCoalescedEvents()PointerEvent instances that were coalesced into the dispatched pointermove event.The PointerEvent interface has several event types. To determine which event fired, look at the event's type property.
event.preventDefault() to keep the mouse event from being sent as well.pointeroverpointerenterpointerdownpointermovepointeruppointercancelpointeroutpointerleavegotpointercapturelostpointercaptureGlobalEventHandlers.onpointeroverglobal event handler for the pointerover event.GlobalEventHandlers.onpointerenterglobal event handler for the pointerenter event.GlobalEventHandlers.onpointerdownglobal event handler for the pointerdown event.GlobalEventHandlers.onpointermoveglobal event handler for the pointermove event.GlobalEventHandlers.onpointerupglobal event handler for the pointerup event.GlobalEventHandlers.onpointercancelglobal event handler for the pointercancel event.GlobalEventHandlers.onpointeroutglobal event handler for the pointerout event.GlobalEventHandlers.onpointerleaveglobal event handler for the pointerleave event.An Example of each property, event type and global event handler is included in their respective reference page.
| Specification | Status | Comment |
|---|---|---|
| Pointer Events – Level 2 The definition of 'PointerEvent' in that specification. | Editor's Draft | Non-stable version. |
| Pointer Events The definition of 'PointerEvent' in that specification. | Recommendation | Initial definition. |
| Feature | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari |
|---|---|---|---|---|---|---|
| Basic support | 55 | 12 |
No 411 |
11 |
42 | No |
PointerEvent() constructor |
55 | 12 |
No 411 |
11 |
42 | No |
pointerId |
55 | 12 |
No 411 |
10 | 42 | No |
width |
55 | 12 |
No 411 |
11 103 |
42 | No |
height |
55 | 12 |
No 411 |
11 103 |
42 | No |
pressure |
55 | 12 |
No 411 |
11 104 |
42 | No |
tangentialPressure |
58 | No |
No 545 |
No | 45 | No |
tiltX |
55 | 12 |
No 411 |
10 | 42 | No |
tiltY |
55 | 12 |
No 411 |
10 | 42 | No |
twist |
58 | No |
No 545 |
No | 45 | No |
pointerType |
55 | 12 |
No 411 |
11 106 |
42 | No |
isPrimary |
55 | 12 |
No 411 |
10 | 42 | No |
getCoalescedEvents |
58 | No | No | No | 45 | No |
| Feature | Android webview | Chrome for Android | Edge mobile | Firefox for Android | IE mobile | Opera Android | iOS Safari |
|---|---|---|---|---|---|---|---|
| Basic support | 55 | 55 | 12 |
No 411 |
11 |
42 | No |
PointerEvent() constructor |
55 | 55 | 12 |
No 411 |
11 |
42 | No |
pointerId |
55 | 55 | 12 |
No 411 |
10 | 42 | No |
width |
55 | 55 | 12 |
No 411 |
11 103 |
42 | No |
height |
55 | 55 | 12 |
No 411 |
11 103 |
42 | No |
pressure |
55 | 55 | 12 |
No 411 |
11 104 |
42 | No |
tangentialPressure |
58 | 58 | No |
No 545 |
No | 45 | No |
tiltX |
55 | 55 | 12 |
No 411 |
10 | 42 | No |
tiltY |
55 | 55 | 12 |
No 411 |
10 | 42 | No |
twist |
58 | 58 | No |
No 545 |
No | 45 | No |
pointerType |
55 | 55 | 12 |
No 411 |
11 106 |
42 | No |
isPrimary |
55 | 55 | 12 |
No 411 |
10 | 42 | No |
getCoalescedEvents |
58 | 58 | No | No | No | 45 | No |
1. From version 41: this feature is behind the dom.w3c_pointer_events.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
2. See MSDN Pointer events updates.
3. Returns values in screen pixels instead of CSS document pixels.
4. Returns 0 instead of 0.5 on hardware that doesn't support pressure.
5. From version 54: this feature is behind the dom.w3c_pointer_events.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
6. Returns an integer enumeration instead of a string.
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent