This API is a shim of the W3C Pointer Events specification and adds features that are out of scope of the current specification.
- Generates Pointer Events according to the current specification.
- Use attribute
touch-actionto set touch action on HTML elements; generates
ms-touch-actionCSS properties when supported by the browser.
- Support Pointer Capture with mouse and touch events.
- Normalize click (Tap) events, double click (double Tap) events, and event button/buttons/which values.
- Supports immediate clicks (no ~300ms delay)
The API has been successfully tested on the following environments.
- Android 4.1.2+ (Stock browser and Chrome)
- BlackBerry 10+
- iOS 6.1.3+
- WindowsPhone 8.x
- Chrome (mouse)
- FireFox (mouse + touchscreen)
- IE10+ (mouse + touchscreen)
Bower release installation:
$ bower install dpointer
Manual master installation:
$ git clone git://github.com/ibm-js/dpointer.git
- Require the module
- Set the attribute
touch-actionon elements you want to handle pointer events. Example:
<div touch-action="none"> </div>
- Start listening to Pointer Events:
pointerdown, pointerup, pointercancel, pointermove,
pointerover, pointerout, pointerenter, pointerleave, gotpointercapture and lostpointercapture.
Setting the Touch Action attribute
- Programmatic: use dpointer/events function
- Declarative: add the attribute
Where actionType can be
<root>/dpointer/events/events.js <root>/requirejs/require.js <root>/domReady/domReady.js
- Pen properties (pressure/tiltx,y/height/width...) are not implemented. Properties are defined with default values. The API has not been tested with pens.
- Avoid to rely on
pointerType. In some cases (for instance, when a mouse is plugged on Android devices), the type may not be accurate (the mouse generates touch events and there is no way to know that they originate from a mouse.).
- No official release, work in progress.
- Use, tests and contributions are welcome: see contributing
- This API was developed with Dojo 2.0 in mind, as a possible replacement of the current Dojo touch API. For more details see ticket #17192
- Sebastien Pereira (IBM CCLA)