Class Touch
- Namespace
- CSharpToJavaScript.APIs.JS
- Assembly
- CSharpToJavaScript.dll
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.
[Value("Touch")]
public class Touch
- Inheritance
-
Touch
- Inherited Members
Remarks
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.
-Touch events
-Document.CreateTouch
Constructors
Touch()
public Touch()
Touch(TouchInit)
The Touch() constructor creates a new Touch object.
public Touch(TouchInit touchInitDict)
Parameters
touchInitDictTouchInit
Remarks
-TouchEvent, the interface of the objects it constructs.
Properties
AltitudeAngle
[Value("altitudeAngle")]
public Number AltitudeAngle { get; }
Property Value
AzimuthAngle
[Value("azimuthAngle")]
public Number AzimuthAngle { get; }
Property Value
ClientX
The Touch.clientX read-only property returns the X coordinate of the touch
point relative to the viewport, not including any scroll offset.
[Value("clientX")]
public Number ClientX { get; }
Property Value
- Number
A
doublefloating point value representing the X coordinate of the touch point
relative to the viewport, not including any scroll offset.
Remarks
ClientY
The Touch.clientY read-only property returns the Y
coordinate of the touch point relative to the browser's viewport, not including any
scroll offset.
[Value("clientY")]
public Number ClientY { get; }
Property Value
- Number
A
doublefloating point value representing the Y coordinate of the touch point
relative to the viewport, not including any scroll offset.
Remarks
Force
The Touch.force read-only property returns the amount of
pressure the user is applying to the touch surface for a Touch point.
[Value("force")]
public Number Force { get; }
Property Value
- Number
A
floatthat represents the amount of pressure the user is applying to the
touch surface. This is a value between0.0(no pressure) and1.0(the maximum amount of pressure the hardware can recognize). A value of0.0is returned if no value is known (for example the touch device does not
support this property). In environments where force is known, the absolute pressure
represented by the force attribute, and the sensitivity in levels of pressure, may vary.
Remarks
Identifier
The Touch.identifier returns a value uniquely identifying
this point of contact with the touch surface. This value remains consistent for every
event involving this finger's (or stylus's) movement on the surface until it is lifted
off the surface.
[Value("identifier")]
public long Identifier { get; }
Property Value
Remarks
PageX
The Touch.pageX read-only property returns the X
coordinate of the touch point relative to the viewport, including any scroll offset.
[Value("pageX")]
public Number PageX { get; }
Property Value
- Number
A
doublefloating point value representing the X coordinate of the touch point
relative to the viewport, including any scroll offset.
Remarks
PageY
The Touch.pageY read-only property returns the Y
coordinate of the touch point relative to the viewport, including any scroll offset.
[Value("pageY")]
public Number PageY { get; }
Property Value
- Number
A
doublefloating point value representing the Y coordinate of the touch point
relative to the viewport, including any scroll offset.
Remarks
RadiusX
The radiusX read-only property of the Touch interface returns the X radius of the ellipse that most closely circumscribes the area of contact with the touch surface. The value is in CSS pixels of the same scale as ScreenX.
[Value("radiusX")]
public Number RadiusX { get; }
Property Value
- Number
A number.
Remarks
This value, in combination with RadiusY and RotationAngle constructs an ellipse that approximates the size and shape of the area of contact between the user and the screen. This may be a relatively large ellipse representing the contact between a fingertip and the screen or a small area representing the tip of a stylus, for example.
RadiusY
The radiusY read-only property of the Touch interface returns the Y radius of the ellipse that most closely circumscribes the area of contact with the touch surface. The value is in CSS pixels of the same scale as ScreenX.
[Value("radiusY")]
public Number RadiusY { get; }
Property Value
- Number
A number.
Remarks
This value, in combination with RadiusX and RotationAngle constructs an ellipse that approximates the size and shape of the area of contact between the user and the screen. This may be a large ellipse representing the contact between a fingertip and the screen or a small one representing the tip of a stylus, for example.
RotationAngle
The rotationAngle read-only property of the Touch interface returns the rotation angle, in degrees, of the contact area ellipse defined by RadiusX and RadiusY. The value may be between 0 and 90. Together, these three values describe an ellipse that approximates the size and shape of the area of contact between the user and the screen. This may be a relatively large ellipse representing the contact between a fingertip and the screen or a small area representing the tip of a stylus, for example.
[Value("rotationAngle")]
public Number RotationAngle { get; }
Property Value
- Number
A number.
Remarks
ScreenX
Returns the X coordinate of the touch point relative to the screen, not including any scroll offset.
[Value("screenX")]
public Number ScreenX { get; }
Property Value
- Number
A number.
Remarks
ScreenY
Returns the Y coordinate of the touch point relative to the screen, not including any scroll offset.
[Value("screenY")]
public Number ScreenY { get; }
Property Value
- Number
A number.
Remarks
Target
The read-only target property of the Touch interface returns the (EventTarget) on which the touch contact 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. Note that if the target element is removed from the document, events will still be targeted at it, and hence won't necessarily bubble up to the window or document anymore. If there is any risk of an element being removed while it is being touched, the best practice is to attach the touch listeners directly to the target.
[Value("target")]
public EventTarget Target { get; }
Property Value
- EventTarget
The EventTarget the Touch object applies to.
Remarks
TouchType
[Value("touchType")]
public TouchType TouchType { get; }