PointerEvent: tangentialPressure property
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2020.
ThetangentialPressure read-only property of thePointerEvent interface represents the normalized tangential pressure ofthe pointer input (also known as barrel pressure orcylinder stress).
In this article
Value
Afloat representing the normalized tangential pressure of the pointerinput in the range-1 to1, inclusive, where0 isthe neutral position of the control.
Note that some hardware may only support positive values in the range0 to1. For hardware that does not support tangential pressure, the value willbe0.
Examples
In this snippet, when apointerdown event is fired, different functionsare called depending on the value of the event'stangentialPressureproperty.
someElement.addEventListener("pointerdown", (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); }});Specifications
| Specification |
|---|
| Pointer Events> # dom-pointerevent-tangentialpressure> |