GamepadButton: touched プロパティ
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
touched
は GamepadButton
インターフェイスのプロパティで、タッチを検出できるボタンが現在タッチされているか (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 GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
touched |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- No support
- No 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.