The tangentialPressure
read-only property of the PointerEvent
interface represents the normalized tangential pressure of the pointer input (also known as barrel pressure or cylinder stress).
Syntax
var tanPressure = pointerEvent.tangentialPressure;
Return value
A float
representing the normalized tangential pressure of the pointer input in the range -1
to 1
, inclusive, where 0
is the neutral position of the control.
Note that some hardware may only support positive values in the range 0
to 1
. For hardware that does not support tangential pressure, the value will be 0
.
Example
In this snippet, when a pointerdown
event is fired, different functions are called depending on the value of the event's tangentialPressure
property.
someElement.addEventListener('pointerdown', function(event) { if (event.tangentialPressure == 0) { // No pressure process_no_tanPressure(event); } else if (event.tangentialPressure == 1) { // Maximum pressure process_max_tanPressure(event); } else { // Default process_tanPressure(event); } }, false);
Specifications
Specification | Status | Comment |
---|---|---|
Pointer Events – Level 2 The definition of 'tangentialPressure' in that specification. |
Recommendation |
Browser compatibility
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
tangentialPressure | Chrome Full support 58 | Edge Full support 79 | Firefox
Full support
59
| IE No support No | Opera Full support 45 | Safari Full support 13 | WebView Android Full support 58 | Chrome Android Full support 58 | Firefox Android
Full support
54
| Opera Android Full support 43 | Safari iOS Full support 13 | Samsung Internet Android Full support 7.0 |
Legend
- Full support
- Full support
- No support
- No support
- User must explicitly enable this feature.
- User must explicitly enable this feature.