Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

PointerEvent.pressure

This article needs a technical review. How you can help.

The normalized pressure of the pointer input in the range of 0 to 1, where 0 and 1 represent the minimum and maximum pressure the hardware is capable of detecting, respectively. For hardware that does not support pressure, including but not limited to mouse, the value MUST be 0.5 when the pointer is active and 0 otherwise.

This property is Read only .

Syntax

var pressure = pointerEvent.pressure;

Return value

pressure
The amount of pressure applied to the pointer.

Example

This example illustrates using the pressure property.

When a pointerdown event is fired, different functions are called depending on the value of the event's pressure property.

someElement.addEventListener('pointerdown', function(ev) {
   if (ev.pressure == 0) {
     // No pressure
     process_no_pressure(ev);
   } else if (ev.pressure == 1) {
     // Maximum pressure
     process_max_pressure(ev);
   } else {
     // Default
     process_pressure(ev);
   }
 }, false);

Specifications

Specification Status Comment
Pointer Events – Level 2
The definition of 'pressure' in that specification.
Editor's Draft Non-stable version.
Pointer Events
The definition of 'pressure' in that specification.
Recommendation Initial definition.

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support Not supported (Yes) [1] 10 Not supported Not supported
Feature Android Android Webview Chrome for Android Firefox Mobile (Gecko) Firefox OS IE Mobile Opera Mobile Safari Mobile
Basic support Not supported Not supported Not supported Not supported Not supported 10 Not supported Not supported

[1] Implementation withdrawn. See bug 1166347.

See also

Document Tags and Contributors

 Contributors to this page: rolfedh, AFBarstow, fscholz
 Last updated by: rolfedh,