Class TouchEvent
- Namespace
- CSharpToJavaScript.APIs.JS
- Assembly
- CSharpToJavaScript.dll
The TouchEvent interface represents an UIEvent which is sent when the state of contacts with a touch-sensitive surface changes. This surface can be a touch screen or trackpad, for example. The event can describe one or more points of contact with the screen and includes support for detecting movement, addition and removal of contact points, and so forth.
[Value("TouchEvent")]
public class TouchEvent : UIEvent
- Inheritance
-
TouchEvent
- Inherited Members
Remarks
Touches are represented by the Touch object; each touch is described by a position, size and shape, amount of pressure, and target element. Lists of touches are represented by TouchList objects.
-Touch events
-GestureEvent
Constructors
TouchEvent()
public TouchEvent()
TouchEvent(string, TouchEventInit)
The TouchEvent() constructor creates a new TouchEvent object.
public TouchEvent(string type, TouchEventInit eventInitDict = null)
Parameters
typestringeventInitDictTouchEventInit
Remarks
NOTE
If you construct a synthetic event using this constructor, that event will not be trusted, for security reasons.
Only browser-generatedTouchEventobjects are trusted and only trusted events trigger default actions.
-TouchEvent, the interface of the objects it constructs.
Properties
AltKey
The read-only altKey property of the TouchEvent interface returns a boolean value indicating whether or not the <kbd>alt</kbd> (Alternate) key is enabled when the touch event is created. If the <kbd>alt</kbd> key is enabled, the attribute's value is true. Otherwise, it is false.
[Value("altKey")]
public bool AltKey { get; }
Property Value
- bool
A boolean value that is
trueif the <kbd>alt</kbd> key is enabled for this event; andfalseif the <kbd>alt</kbd> is not enabled.
Remarks
This property is {{ReadOnlyInline}}.
ChangedTouches
The changedTouches read-only property is a TouchList whose touch points (Touch objects) varies depending on the event type, as follows:
[Value("changedTouches")]
public TouchList ChangedTouches { get; }
Property Value
- TouchList
A TouchList whose Touch objects include all the touch points that contributed to this touch event.
Remarks
CtrlKey
The read-only ctrlKey property of the TouchEvent interface returns a boolean value indicating whether the <kbd>control</kbd> (Control) key is enabled when the touch event is created. If this key is enabled, the attribute's value is true. Otherwise, it is false.
[Value("ctrlKey")]
public bool CtrlKey { get; }
Property Value
- bool
A boolean value that is
trueif the <kbd>control</kbd> key is enabled for this event; andfalseif the <kbd>control</kbd> is not enabled.
Remarks
This property is {{ReadOnlyInline}}.
MetaKey
The read-only metaKey property of the TouchEvent interface returns a boolean value indicating whether or not the <kbd>Meta</kbd> key is enabled when the touch event is created. If this key is enabled, the attribute's value is true. Otherwise, it is false.
[Value("metaKey")]
public bool MetaKey { get; }
Property Value
- bool
A boolean value that is
trueif the <kbd>Meta</kbd> key is enabled for this event; andfalseif the <kbd>Meta</kbd> is not enabled.
Remarks
This property is {{ReadOnlyInline}}.
NOTE
On Macintosh keyboards, this is the <kbd>⌘ Command</kbd> key. On Windows keyboards, this is the Windows key (<kbd>⊞</kbd>).
ShiftKey
The read-only shiftKey property of the TouchEvent interface returns a boolean value indicating whether or not the <kbd>shift</kbd> key is enabled when the touch event is created. If this key is enabled, the attribute's value is true. Otherwise, it is false.
[Value("shiftKey")]
public bool ShiftKey { get; }
Property Value
- bool
The boolean value
trueif the <kbd>shift</kbd> key is enabled for this event; andfalseif the <kbd>shift</kbd> key is not enabled.
Remarks
TargetTouches
The targetTouches read-only property is a TouchList listing all the Touch objects for touch points that are still in contact with the touch surface and whose Elementtouchstart event occurred inside the same target Element as the current target element.
[Value("targetTouches")]
public TouchList TargetTouches { get; }
Property Value
- TouchList
A TouchList listing all the Touch objects for touch points that are still in contact with the touch surface and whose
touchstartevent occurred inside the same target Element as the current target element.
Remarks
Touches
touches is a read-only TouchList listing
all the Touch objects for touch points that are currently in contact
with the touch surface, regardless of whether or not they've changed or what their
target element was at Elementtouchstart time.
[Value("touches")]
public TouchList Touches { get; }
Property Value
- TouchList
A TouchList listing all the Touch objects for touch points that are still in contact with the touch surface, regardless of whether or not they've changed or what their target element was at
touchstart
time.
Remarks
You can think of it as how many separate fingers are able to be identified as touching
the screen.
NOTE
Touches inside the array are not necessarily ordered by order of occurrences (the
i-th element in the array being the i-th touch that happened). You cannot assume a specific order. To determine the order of occurrences of the touches, use thetouchobject IDs.