包含一个触摸屏设备上所有当前触摸点的一个数组 Array。
touches 数组默认为空。当用户触摸屏幕时,一个新的触摸点会被追踪并添加到这个数组中。触摸点是带有以下属性的对象 Objects:
// Iterate over the touches array.
for (let touch of touches) {
// x-coordinate relative to the top-left
// corner of the canvas.
console.log(touch.x);
<p> // y-coordinate relative to the top-left
// corner of the canvas.
console.log(touch.y);</p>
<p> // x-coordinate relative to the top-left
// corner of the browser.
console.log(touch.winX);</p>
<p> // y-coordinate relative to the top-left
// corner of the browser.
console.log(touch.winY);</p>
<p> // ID number
console.log(touch.id);
}
</p>示例
This page is generated from the comments in src/events/touch.js . Please feel free to edit it and submit a pull request!