GamepadButton: touched プロパティ

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

touchedGamepadButton インターフェイスのプロパティで、タッチを検出できるボタンが現在タッチされているか (true) またはタッチされていないか (false) を示す論理値を返します。

ボタンがタッチを検出できないがアナログ値を返すことができる場合、プロパティは値が 0 より大きければ true となり、そうでなければ false となります。ボタンがタッチを検出できず、デジタル値しか返せない場合は、GamepadButton.pressed プロパティを反映します。

論理値 (Boolean) です。タッチされていれば true です。

js
let gp = navigator.getGamepads()[0]; // 最初のゲームパッドオブジェクトを取得

if (gp.buttons[0].touched) {
  // タッチされているボタンに応答
}

仕様書

Specification
Gamepad
# dom-gamepadbutton-touched

ブラウザーの互換性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
touched

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support

関連情報