touches

タッチスクリーンデバイス上の現在のすべてのタッチポイントを含むArrayです。

touches配列はデフォルトでは空です。ユーザーが画面に触れると、 新しいタッチポイントが追跡され、配列に追加されます。タッチポイントは 以下のプロパティを持つObjectです:

// touches配列を反復処理します。
for (let touch of touches) {
  // キャンバスの左上隅を基準とした
  // x座標。
  console.log(touch.x);

  // キャンバスの左上隅を基準とした
  // y座標。
  console.log(touch.y);

  // ブラウザの左上隅を基準とした
  // x座標。
  console.log(touch.winX);

  // ブラウザの左上隅を基準とした
  // y座標。
  console.log(touch.winY);

  // ID番号
  console.log(touch.id);
}

実例

This page is generated from the comments in src/events/touch.js . Please feel free to edit it and submit a pull request!

関連するリファレンス