web api interface
Touch
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 radiusX, radiusY, and 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
forcevalue will always be 0. This may also be the case forradiusXandradiusY; if the hardware reports only a single point, these values will be 1.
Constructor
Touch()- : Creates a Touch object.
Instance properties
This interface has no parent, and doesn’t inherit or implement other properties.
Basic properties
identifierRead only- : Returns a unique identifier for this
Touchobject. 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.
- : Returns a unique identifier for this
screenXRead only- : Returns the X coordinate of the touch point relative to the left edge of the screen.
screenYRead only- : Returns the Y coordinate of the touch point relative to the top edge of the screen.
clientXRead only- : Returns the X coordinate of the touch point relative to the left edge of the browser viewport, not including any scroll offset.
clientYRead only- : Returns the Y coordinate of the touch point relative to the top edge of the browser viewport, not including any scroll offset.
pageXRead only- : Returns the X coordinate of the touch point relative to the left edge of the document. Unlike
clientX, this value includes the horizontal scroll offset, if any.
- : Returns the X coordinate of the touch point relative to the left edge of the document. Unlike
pageYRead only- : Returns the Y coordinate of the touch point relative to the top of the document. Unlike
clientY, this value includes the vertical scroll offset, if any.
- : Returns the Y coordinate of the touch point relative to the top of the document. Unlike
targetRead only- : Returns the
Elementon 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.
- : Returns the
Touch area
radiusXRead only- : Returns the X radius of the ellipse that most closely circumscribes the area of contact with the screen. The value is in pixels of the same scale as
screenX.
- : Returns the X radius of the ellipse that most closely circumscribes the area of contact with the screen. The value is in pixels of the same scale as
radiusYRead only- : Returns the Y radius of the ellipse that most closely circumscribes the area of contact with the screen. The value is in pixels of the same scale as
screenY.
- : Returns the Y radius of the ellipse that most closely circumscribes the area of contact with the screen. The value is in pixels of the same scale as
rotationAngleRead only- : 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.
forceRead only- : Returns the amount of pressure being applied to the surface by the user, as a
floatbetween0.0(no pressure) and1.0(maximum pressure).
- : Returns the amount of pressure being applied to the surface by the user, as a
Touch type and angle
altitudeAngleRead only- : Returns the angle (in radians) between the transducer (pointer or stylus) axis and the X-Y plane of the device, in the range
0(parallel to the surface) toπ/2(perpendicular to the surface). Defaults to0for hardware that does not report tilt or angle.
- : Returns the angle (in radians) between the transducer (pointer or stylus) axis and the X-Y plane of the device, in the range
azimuthAngleRead only- : Returns the azimuth angle (in radians) of the transducer (pointer or stylus), in the range
0to2π.0represents a transducer whose cap is pointing in the direction of increasing X values on the X-Y plane, and values increase clockwise.
- : Returns the azimuth angle (in radians) of the transducer (pointer or stylus), in the range
touchTypeRead only- : Returns the type of device that triggered the touch, such as
"direct"for a finger or"stylus"for a pen device.
- : Returns the type of device that triggered the touch, such as
Instance methods
This interface has no methods and no parent, and doesn’t inherit or implement any methods.