# Touch

The Touch API provides access to touch events generated by a touchscreen or other touch-sensitive input devices. It allows web applications to respond to user gestures such as taps, swipes, pinches, and rotations.

Each touch point contains information such as its coordinates, the element it interacts with, and a unique identifier.

Modern touchscreens can detect multiple simultaneous points of contact.

**Usage**

```twig
<canvas {{ stimulus_controller('@pwa/touch')></canvas>
```

### Parameters

None

### Actions

None

### Targets

None

### Events

`started`: Emitted for each new contact detected. Can fire multiple times if multiple fingers touch the screen simultaneously. The event contains the native Touch object.

`moved`: Emitted for each contact that moves. The event contains the native Touch object.

`cancelled`: Emitted when a contact is canceled by the browser or OS (e.g., context switch, gesture interruption). The event contains the native Touch object.

`ended`: Emitted when a contact ends.

`updated`: Emitted after each native event, once per DOM event cycle. Provides a full snapshot of all active touches managed by the controller. Useful for multi-touch gestures (e.g., pinch-zoom, rotation) since it reflects the complete state of all contact points.

```javascript
{
    touches: Array<{
        identifier: number;
        clientX: number;
        clientY: number;
        pageX: number;
        pageY: number;
        screenX: number;
        screenY: number;
        radiusX: number;
        radiusY: number;
        force: number;
        rotationAngle: number;
        top: number;
        left: number;
    }>
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://pwa.spomky-labs.com/1.3.x/symfony-ux/touch.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
