触摸
interface represents a single contact point on a touch-sensitive device. The contact point is commonly a finger or stylus and the device may be a touchscreen or trackpad.
Touch.radiusX
,
Touch.radiusY
,和
Touch.rotationAngle
describe the area of contact between the user and the screen, the
touch area
. This can be helpful when dealing with imprecise pointing devices such as fingers. These values are set to describe an ellipse that as closely as possible matches the entire area of contact (such as the user's fingertip).
注意:
Many of the properties' values are hardware-dependent; for example, if the device doesn't have a way to detect the amount of pressure placed on the surface, the
force
value will always be 0. This may also be the case for
radiusX
and
radiusY
; if the hardware reports only a single point, these values will be 1.
Touch()
Creates a Touch object.
This interface has no parent, and doesn't inherits or implements any other property.
Touch.identifier
只读
触摸
object. A given touch point (say, by a finger) will have the same identifier for the duration of its movement around the surface. This lets you ensure that you're tracking the same touch all the time.
Touch.screenX
只读
Returns the X coordinate of the touch point relative to the left edge of the screen.
Touch.screenY
只读
Returns the Y coordinate of the touch point relative to the top edge of the screen.
Touch.clientX
只读
Returns the X coordinate of the touch point relative to the left edge of the browser viewport, not including any scroll offset.
Touch.clientY
只读
Returns the Y coordinate of the touch point relative to the top edge of the browser viewport, not including any scroll offset.
Touch.pageX
只读
clientX
, this value includes the horizontal scroll offset, if any.
Touch.pageY
只读
clientY,
this value includes the vertical scroll offset, if any.
Touch.target
只读
元素
on which the touch point started when it was first placed on the surface, even if the touch point has since moved outside the interactive area of that element or even been removed from the document.
这是
实验性技术
检查
浏览器兼容性表格
要小心谨慎在生产中使用这之前。
Touch.radiusX
只读
screenX
.
Touch.radiusY
只读
screenY
.
Touch.rotationAngle
只读
Returns the angle (in degrees) that the ellipse described by radiusX and radiusY must be rotated, clockwise, to most accurately cover the area of contact between the user and the surface.
Touch.force
只读
float
between
0.0
(no pressure) and
1.0
(maximum pressure).
This interface has no method and no parent, and doesn't inherits or implements any method.
| 规范 | 状态 | 注释 |
|---|---|---|
|
Touch Events – Level 2
The definition of 'Touch' in that specification. |
草案 |
添加
radiusX
,
radiusY
,
rotationAngle
,
force
properties, as well as the
Touch()
构造函数。
|
|
触摸事件
The definition of 'Touch' in that specification. |
推荐 | 初始定义。 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
触摸
|
Chrome 22 | Edge ≤18 |
Firefox
52
注意事项
|
IE 不支持 No | Opera Yes | Safari 不支持 No | WebView Android Yes | Chrome Android Yes | Firefox Android 6 | Opera Android Yes | Safari iOS Yes | Samsung Internet Android Yes |
Touch()
构造函数
|
Chrome 48 | Edge 79 | Firefox 46 | IE 不支持 No | Opera 35 | Safari 不支持 No | WebView Android 48 | Chrome Android 48 | Firefox Android 6 | Opera Android Yes | Safari iOS Yes | Samsung Internet Android 5.0 |
clientX
|
Chrome 22 | Edge ≤18 |
Firefox
52
注意事项
|
IE 不支持 No | Opera Yes | Safari 不支持 No | WebView Android Yes | Chrome Android Yes | Firefox Android 6 | Opera Android Yes | Safari iOS Yes | Samsung Internet Android Yes |
clientY
|
Chrome 22 | Edge ≤18 |
Firefox
52
注意事项
|
IE 不支持 No | Opera Yes | Safari 不支持 No | WebView Android Yes | Chrome Android Yes | Firefox Android 6 | Opera Android Yes | Safari iOS Yes | Samsung Internet Android Yes |
force
|
Chrome Yes | Edge ≤79 | Firefox Yes | IE 不支持 No | Opera Yes | Safari 不支持 No | WebView Android Yes | Chrome Android Yes | Firefox Android Yes | Opera Android Yes | Safari iOS Yes | Samsung Internet Android Yes |
标识符
|
Chrome 22 | Edge ≤18 |
Firefox
52
注意事项
|
IE 不支持 No | Opera Yes | Safari 不支持 No | WebView Android Yes | Chrome Android Yes | Firefox Android 6 | Opera Android Yes | Safari iOS Yes | Samsung Internet Android Yes |
pageX
|
Chrome 22 | Edge ≤18 |
Firefox
52
注意事项
|
IE 不支持 No | Opera Yes | Safari 不支持 No | WebView Android Yes | Chrome Android Yes | Firefox Android 6 | Opera Android Yes | Safari iOS Yes | Samsung Internet Android Yes |
pageY
|
Chrome 22 | Edge ≤18 |
Firefox
52
注意事项
|
IE 不支持 No | Opera Yes | Safari 不支持 No | WebView Android Yes | Chrome Android Yes | Firefox Android 6 | Opera Android Yes | Safari iOS Yes | Samsung Internet Android Yes |
radiusX
|
Chrome 43 | Edge ≤79 | Firefox ? | IE 不支持 No | Opera Yes | Safari 不支持 No | WebView Android 43 | Chrome Android 43 | Firefox Android Yes | Opera Android Yes | Safari iOS Yes | Samsung Internet Android 4.0 |
radiusY
|
Chrome 43 | Edge ≤79 | Firefox ? | IE 不支持 No | Opera Yes | Safari 不支持 No | WebView Android 43 | Chrome Android 43 | Firefox Android Yes | Opera Android Yes | Safari iOS Yes | Samsung Internet Android 4.0 |
rotationAngle
|
Chrome 43 | Edge ≤79 | Firefox ? | IE 不支持 No | Opera Yes | Safari 不支持 No | WebView Android 43 | Chrome Android 43 | Firefox Android Yes | Opera Android Yes | Safari iOS Yes | Samsung Internet Android 4.0 |
screenX
|
Chrome 22 | Edge ≤18 |
Firefox
52
注意事项
|
IE 不支持 No | Opera Yes | Safari 不支持 No | WebView Android Yes | Chrome Android Yes | Firefox Android 6 | Opera Android Yes | Safari iOS Yes | Samsung Internet Android Yes |
screenY
|
Chrome 22 | Edge ≤18 |
Firefox
52
注意事项
|
IE 不支持 No | Opera Yes | Safari 不支持 No | WebView Android Yes | Chrome Android Yes | Firefox Android 6 | Opera Android Yes | Safari iOS Yes | Samsung Internet Android Yes |
target
|
Chrome 22 | Edge ≤18 |
Firefox
52
注意事项
|
IE 不支持 No | Opera Yes | Safari 不支持 No | WebView Android Yes | Chrome Android Yes | Firefox Android 6 | Opera Android Yes | Safari iOS Yes | Samsung Internet Android Yes |
完整支持
不支持
兼容性未知
实验。期望将来行为有所改变。
见实现注意事项。