The Touch 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.
The Touch.radiusX, Touch.radiusY, and 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).
Note: 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()
This interface has no parent, and doesn't inherits or implements any other property.
Touch.identifier Read only
Touch 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 Read only
Touch.screenY Read only
Touch.clientX Read only
Touch.clientY Read only
Touch.pageX Read only
clientX, this value includes the horizontal scroll offset, if any.Touch.pageY Read only
clientY, this value includes the vertical scroll offset, if any.Touch.target Read only
Element 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. This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
Touch.radiusX Read only
screenX.Touch.radiusY Read only
screenY.Touch.rotationAngle Read only
Touch.forceRead only
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.
| Specification | Status | Comment |
|---|---|---|
| Touch Events – Level 2 The definition of 'Touch' in that specification. | Draft | Added radiusX, radiusY, rotationAngle, force properties, as well as the Touch() constructor. |
| Touch Events The definition of 'Touch' in that specification. | Recommendation | Initial definition. |
| Desktop | ||||||
|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | |
| Basic support | 22 | Yes | 52
|
No | No | No |
Touch() constructor
|
48 | No | 46 | No | 35 | ? |
clientX |
22 | Yes | 52
|
No | No | No |
clientY |
22 | Yes | 52
|
No | No | No |
force
|
Yes | ? | Yes | ? | ? | ? |
identifier |
22 | Yes | 52
|
No | No | No |
pageX |
22 | Yes | 52
|
No | No | No |
pageY |
22 | Yes | 52
|
No | No | No |
radiusX
|
43 | ? | ? | ? | ? | ? |
radiusY
|
43 | ? | ? | ? | ? | ? |
rotationAngle
|
43 | ? | ? | ? | ? | ? |
screenX |
22 | Yes | 52
|
No | No | No |
screenY |
22 | Yes | 52
|
No | No | No |
target |
22 | Yes | 52
|
No | No | No |
| Mobile | |||||||
|---|---|---|---|---|---|---|---|
| Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | iOS Safari | Samsung Internet | |
| Basic support | Yes | Yes | Yes | 6 | Yes | Yes | ? |
Touch() constructor
|
48 | 48 | Yes | 6 | Yes | Yes | Yes |
clientX |
Yes | Yes | Yes | 6 | Yes | Yes | ? |
clientY |
Yes | Yes | Yes | 6 | Yes | Yes | ? |
force
|
Yes | Yes | ? | Yes | ? | Yes | ? |
identifier |
Yes | Yes | Yes | 6 | Yes | Yes | ? |
pageX |
Yes | Yes | Yes | 6 | Yes | Yes | ? |
pageY |
Yes | Yes | Yes | 6 | Yes | Yes | ? |
radiusX
|
43 | 43 | ? | ? | ? | Yes | ? |
radiusY
|
43 | 43 | ? | ? | ? | Yes | ? |
rotationAngle
|
43 | 43 | ? | ? | ? | Yes | ? |
screenX |
Yes | Yes | Yes | 6 | Yes | Yes | ? |
screenY |
Yes | Yes | Yes | 6 | Yes | Yes | ? |
target |
Yes | Yes | Yes | 6 | Yes | Yes | ? |
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/Touch