Skip to main content

Basics

W3C Pointer Events defines Pointer Event for following types of input devices:

Pointer Device TypepointerType Value
Mousemouse
Pen Styluspen
Touch Contacttouch

Wacom devices report pen and touch value in the following format:

PointerEvent Interface

dictionary PointerEventInit : MouseEventInit {

long pointerId = 0;
double width = 1;
double height = 1;
float pressure = 0;
float tangentialPressure = 0;
long tiltX = 0;
long tiltY = 0;
long twist = 0;
DOMString pointerType = "";
boolean isPrimary = false;

};

[Constructor(DOMString type, optional PointerEventInit eventInitDict), Exposed=Window]

interface PointerEvent : MouseEvent {
readonly attribute long pointerId;
readonly attribute double width;
readonly attribute double height;
readonly attribute float pressure;
readonly attribute float tangentialPressure;
readonly attribute long tiltX;
readonly attribute long tiltY;
readonly attribute long twist;
readonly attribute DOMString pointerType;
readonly attribute boolean isPrimary;

};

Refer to section 3 for detailed examples and section 5 for interface definitions and usages: https://www.w3.org/TR/pointerevents

See Also

Overview – Information on the Web API

Reference – Links to the Web API documents

FAQs – Useful Web programming tips

Sample Code – Full Web demo samples