pub struct Touch(/* private fields */);
Expand description
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.
Implementations§
Source§impl Touch
impl Touch
Sourcepub fn identifier(&self) -> i32
pub fn identifier(&self) -> i32
Returns a unique identifier for this 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.
Sourcepub fn screen_x(&self) -> f64
pub fn screen_x(&self) -> f64
Returns the X coordinate of the touch point relative to the left edge of the screen.
Sourcepub fn screen_y(&self) -> f64
pub fn screen_y(&self) -> f64
Returns the Y coordinate of the touch point relative to the left edge of the screen.
Sourcepub fn client_x(&self) -> f64
pub fn client_x(&self) -> f64
Returns the X coordinate of the touch point relative to the left edge of the browser viewport, not including any scroll offset.
Sourcepub fn client_y(&self) -> f64
pub fn client_y(&self) -> f64
Returns the Y coordinate of the touch point relative to the left edge of the browser viewport, not including any scroll offset.
Sourcepub fn page_x(&self) -> f64
pub fn page_x(&self) -> f64
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.
Sourcepub fn page_y(&self) -> f64
pub fn page_y(&self) -> f64
Returns the Y coordinate of the touch point relative to the left edge of the document. Unlike clientX, this value includes the horizontal scroll offset, if any.
Sourcepub fn target(&self) -> EventTarget
pub fn target(&self) -> EventTarget
Returns the 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.
Sourcepub fn radius_x(&self) -> f64
pub fn radius_x(&self) -> f64
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.
Sourcepub fn radius_y(&self) -> f64
pub fn radius_y(&self) -> f64
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.
Sourcepub fn rotation_angle(&self) -> f64
pub fn rotation_angle(&self) -> f64
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.
Sourcepub fn force(&self) -> f64
pub fn force(&self) -> f64
Returns the amount of pressure being applied to the surface by the user, as a float between 0.0 (no pressure) and 1.0 (maximum pressure).
Sourcepub fn altitude_angle(&self) -> f64
pub fn altitude_angle(&self) -> f64
The altitude (in radians) of a stylus, in the range 0 (parallel to the surface) to π/2 (perpendicular to the surface). The value 0 should be used for devices which do not support this property.
Sourcepub fn azimuth_angle(&self) -> f64
pub fn azimuth_angle(&self) -> f64
The azimuth angle (in radians) of a stylus, in the range 0 to 2π. 0 represents a stylus whose cap is pointing in the direction of increasing screenX values. π/2 represents a stylus whose cap is pointing in the direction of increasing screenY values. The value 0 should be used for devices which do not support this property.
Sourcepub fn touch_type(&self) -> TouchType
pub fn touch_type(&self) -> TouchType
The type of device used to trigger the touch.