Class: TouchEvent

pc.TouchEvent

A Event corresponding to touchstart, touchend, touchmove or touchcancel. TouchEvent wraps the standard browser event and provides lists of pc.Touch objects.

Constructor

new TouchEvent(device, event)

Create a new TouchEvent from an existing browser event
Parameters:
Name Type Description
device pc.TouchDevice The source device of the touch events
event TouchEvent The original browser TouchEvent
Properties:
Name Type Description
element Element The target Element that the event was fired from
touches Array.<pc.Touch> A list of all touches currently in contact with the device
changedTouches Array.<pc.Touch> A list of touches that have changed since the last event
Source:

Methods

getTouchById(id, list) → {pc.Touch}

Get an event from one of the touch lists by the id. It is useful to access touches by their id so that you can be sure you are referencing the same touch.
Parameters:
Name Type Description
id Number The identifier of the touch.
list Array.<pc.Touch> An array of touches to search.
Source:
Returns:
The pc.Touch object or null.
Type
pc.Touch