EN
Ce contenu n’est pas disponible dans votre langue. Voici la version anglaise.

PointerEvent object

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

Note  Starting with Internet Explorer 11, the MS vendor prefix version of this object is no longer supported: the event.type property of a MSPointerEvent object will return the unprefixed PointerEvent name, regardless of the name used to register the event listener.

For a summary of all changes to the Internet Explorer Pointer Events implementation since a Windows Store app using JavaScript, see Pointer Events updates.

DOM Information

Inheritance Hierarchy

 Event
  UIEvent
   MouseEvent
     PointerEvent

Members

The PointerEvent object has these types of members:

Events

The PointerEvent object has these events.

EventDescription
gotpointercapture

Dispatched prior to the dispatch of the first event after pointer capture is set for a pointer.

lostpointercapture

Dispatched after pointer capture is released for a pointer.

MSPointerHover

Event that is triggered when a contact (normally a pen) moves over an element without touching the surface.

pointercancel

Dispatched when either (1) the system has determined that a pointer is unlikely to continue to produce events (for example, due to a hardware event), or (2) after having fired the pointerdown event, the pointer is subsequently used to manipulate the page viewport (for example, 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 outside of 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.

pointermove

Dispatched when a pointer changes coordinates, button state, pressure, tilt, or contact geometry (for example, 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.

 

Methods

The PointerEvent object has these methods.

MethodDescription
getCurrentPoint

Retrieves a PointerPoint object that provides basic info on the pointer associated with the event.

getIntermediatePoints

Retrieves a collection of PointerPoint objects that represent the pointer history from the last pointer event up to and including the current pointer event. Each PointerPoint in the collection provides basic info on the pointer associated with the event.

initPointerEvent

Used to create an PointerEvent from JavaScript.

releasePointerCapture

Releases a pointer captured by an element (using the setPointerCapture method).

setPointerCapture

Assigns a specified pointer to an element. This method is used to ensure that an element continues to receive pointer events even if the contact moves off the element.

 

Properties

The PointerEvent object has these properties.

PropertyAccess typeDescription

currentPoint

Read-only

Gets a PointerPoint object that provides basic info on the pointer associated with the event.

height

Read-only

The height (magnitude on the Y axis), in CSS pixels, of the contact geometry of the pointer.

hwTimestamp

Read-only

Returns the time at which the pointer data was reported by the hardware, in microseconds.

intermediatePoints

Read-only

Retrieves a collection of PointerPoint objects that represent the pointer history from the last pointer event up to and including the current pointer event. Each PointerPoint in the collection provides basic info on the pointer associated with the event.

isPrimary

Read-only

Returns whether the pointer associated with the event is the primary pointer for the current mouse, touch, or pen interaction.

pointerId

Read-only

The unique identifier of the contact for a touch, mouse or pen.

pointerType

Read-only

Returns whether the source of the event is touch, pen or mouse.

pressure

Read-only

Returns 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

Read-only

Returns the angle between the Y-Z plane and the plane containing the pen axis and the Y axis in the range of -90 to +90. A positive X tilt is to the right.

tiltY

Read-only

Returns the angle between the X-Z and transducer-X planes. A positive Y tilt is toward the user.

timeStamp

Gets the time, in milliseconds, when an event occurred.

width

Read-only

The width (magnitude on the X axis), in CSS pixels, of the contact geometry of the pointer.

 

Remarks

Unlike mouse events, pointer events are fired by touch, pen, or mouse contact.

See also

document
Element
Window
Pointer Events
touch-action

 

 

Afficher:
© 2014 Microsoft