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) in the range -1 to 1, 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.
var tanPressure = pointerEvent.tangentialPressure;
A float representing the amount of tangential pressure applied to the pointer.
When a pointerdown event is fired, different functions are called depending on the value of the event's tangentialPressure property.
someElement.addEventListener('pointerdown', function(ev) {
if (ev.tangentialPressure == 0) {
// No pressure
process_no_tanPressure(ev);
} else if (ev.tangentialPressure == 1) {
// Maximum pressure
process_max_tanPressure(ev);
} else {
// Default
process_tanPressure(ev);
}
}, false);
| Specification | Status | Comment |
|---|---|---|
| Pointer Events – Level 2 The definition of 'tangentialPressure' in that specification. | Working Draft |
| Desktop | ||||||
|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | |
| Basic support | 58 | No | 59
|
No | 45 | No |
| Mobile | |||||||
|---|---|---|---|---|---|---|---|
| Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | iOS Safari | Samsung Internet | |
| Basic support | 58 | 58 | No | No
|
45 | No | 7.0 |
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/tangentialPressure