TouchSystem System

Provides access to touch point events.

Note: Additional events and methods are inherited from the TouchState component.


TouchOver [Data = {TouchPointEvent}]
when a finger enters an entity
TouchOut [Data = {TouchPointEvent}]
when a finger leaves an entity

The event callbacks are triggered with the native TouchEvent received by Crafty's stage (Crafty.stage.elem), which is wrapped in a standard Crafty event object (see TouchState). Note that for each changed Touch point) a separate Crafty TouchPointEvent event is triggered.

These touch point events are triggered on the TouchSystem itself. Additionally, they are dispatched to the closest (visible & Touch-enhanced) entity to the source of the event (if available).

Note: By default, touch events are treated as mouse events and are not triggered by this system. To change this behaviour (and enable multitouch) use Crafty.multitouch.