This page is Almost Ready

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

PointerEvent

Summary

Provides contextual information associated with input events (for example, from mouse, touch or pen).

Inherits from MouseEventMouseEvent

Properties

height
The height (magnitude on the Y axis), in CSS pixels, of the contact geometry of the pointer.
isPrimary
Returns whether the pointer associated with the event is the primary pointer for the current mouse, touch, or pen interaction.
pointerId
A unique identifier for the pointer causing the event
pointerType
Indicates the device type that caused the event (mouse, pen, touch, etc.).
pressure
The normalized pressure of the pointer input in the range of [0,1], where 0 and 1 represent the minimum and maximum pressure the hardware is capable of detecting, respectively.
tiltX
The plane angle (in degrees, in the range of [-90,90]) between the Y-Z plane and the plane containing both the transducer (e.g. pen stylus) axis and the Y axis.
tiltY
The plane angle (in degrees, in the range of [-90,90]) between the X-Z plane and the plane containing both the transducer (e.g. pen stylus) axis and the X axis.
width
The width (magnitude on the X axis), in CSS pixels, of the contact geometry of the pointer.

Methods

initPointerEvent
Initializes a new PointerEvent created by the createEvent method.

Events

gotpointercapture
Dispatched prior to the dispatch of the first event after pointer capture is set for a pointer. See the PointerEvent object.
lostpointercapture
Dispatched after pointer capture is released for a pointer.
pointercancel
Dispatched when either (1) the user agent has determined that a pointer is unlikely to continue to produce events (e.g., due to a hardware event), or (2) after having fired the pointerdown event, the pointer is subsequently used to manipulate the page viewport (e.g., panning or zooming).
pointerdown
Dispatched when a pointer enters the state of having a non-zero value for the buttons property.
pointerenter
Dispatched when a pointing device is moved into the hit test boundaries of an element or one of its descendants, including as a result of a pointerdown event from a device that does not support hover.
pointerleave
Dispatched when a pointing device is moved off of the hit test boundaries of an element and all of its descendants, including as a result of a pointerup event from a device that does not support hover.
pointermove
Dispatched when a pointer changes coordinates, button state, pressure, tilt, or contact geometry (e.g. width and height).
pointerout
Dispatched when any of the following occurs:
  • A pointing device is moved out of the hit test boundaries of an element
  • After firing the pointerup event for a device that does not support hover
  • After firing the pointercancel event
pointerover
Dispatched when a pointing device is moved into the hit test boundaries of an element. Also dispatched prior to a pointerdown event for devices that do not support hover.
pointerup
Dispatched when a pointer leaves the state of having a non-zero value for the buttons property.

Inherited from MouseEvent

Properties

button
Gets the mouse button that caused an event.
buttons
Gets a value that indicates which mouse buttons a user pressed.
clientX
Gets the x-coordinate of the mouse pointer, relative to the upper-left corner of the viewport (that is, the user agent’s client area).
clientY
Gets the y-coordinate of the mouse pointer, relative to the upper-left corner of the viewport (that is, the user agent’s client area).
layerX
Gets the x-coordinate of the mouse pointer, relative to the last positioned ancestor element.
layerY
Returns the horizontal coordinate of the event relative to the current layer. layerY is a non-standards property of the MouseEvent object.
relatedTarget
Gets the secondary element that is involved in an event. The relatedTarget property is used to find the other element, if any, involved in an event. Events like mouseover are oriented around a certain target, but also involve a secondary target, such as the target that is exited as the mouseover event fires for the primary target.
screenX
Gets the x-coordinate of the mouse pointer, relative to the upper-left corner of the screen.
screenY
Gets the y-coordinate of the mouse pointer, relative to the upper-left corner of the screen.
x
Gets the x-coordinate of the mouse cursor, relative to the last positioned ancestor element.
y
Gets the y-coordinate of the mouse pointer, relative to the last positioned ancestor element.

Methods

initMouseEvent
Initializes a new mouse event that the createEvent method created.

Events

click
The click event is triggered for an element when it is activated by a mouse click or by another user action that normally has the same effect as a mouse click.
dblclick
A mouse double click event.
mousedown
Fires when the user clicks the object with either mouse button or taps the mouse pad.
mouseenter
Fires when the user moves the mouse pointer into the object.
mouseleave
Fires when the user moves the mouse pointer outside the boundaries of the object.
mousemove
Fires when the user moves the mouse over the object.
mouseout
Fires when the user moves the mouse pointer outside the boundaries of the object.
mouseover
Fires when the user moves the mouse pointer into the object.
mouseup
Fires when the user releases a mouse button while the mouse is over the object.

Related specifications

Pointer Events
Working Draft

See also

Related articles

Pointer Events

Attributions