PointerEvent: tangentialPressure プロパティ
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.
tangentialPressure
は PointerEvent
インターフェイスの読み取り専用プロパティで、ポインター入力の正規化された接線方向の圧力(バレル圧力またはシリンダー応力(cylinder stress)とも呼ばれます)を表します。
値
ポインター入力の正規化された接線方向の圧力を表す -1
から 1
の範囲の float
値。ここで、0
はコントロールの中立位置です。
ハードウェアによっては、0
から 1
の範囲の正の値しかサポートしない場合があることに注意してください。 接線方向の圧力をサポートしないハードウェアの場合、値は 0
になります。
例
このスニペットでは、 pointerdown
イベントが発生すると、イベントの tangentialPressure
プロパティの値に応じてさまざまな関数が呼び出されます。
js
someElement.addEventListener(
"pointerdown",
(event) => {
if (event.tangentialPressure === 0) {
// 圧力なし
process_no_tanPressure(event);
} else if (event.tangentialPressure === 1) {
// 最大圧力
process_max_tanPressure(event);
} else {
// デフォルト
process_tanPressure(event);
}
},
false,
);
仕様書
Specification |
---|
Pointer Events # dom-pointerevent-tangentialpressure |
ブラウザーの互換性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
tangentialPressure |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
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.