# Touch interaction on mobile

Track fingers by identity, not by their position in an array. A second finger can arrive while the first moves; a cancelled contact must disappear even if it never produces a normal release.

Run the [pointer pad](../mouse/index.md) on a touch-capable host. Each held contact produces a circle, and the count returns to zero after release. The example keeps a dictionary keyed by `PointerId`, with capacity reserved before input arrives.

## Follow a contact's lifetime

The native `TouchEventRef` contains a span of `Touch` values. Each touch has an `Index`, a position, and a phase: `Start`, `Move`, `End`, or `Cancel`. `EventRouter` converts these into the same `Down`, `Move`, `Up`, and `Cancel` pointer events used by views.

On `Down`, store the contact's current position and capture its ID if the surface owns the gesture. On `Move`, update an existing entry; a move alone should not create a new pressed contact. On `Up`, `Cancel`, or `LostCapture`, remove the entry and release capture. Clear remaining contacts on deactivation.

IDs can be reused after release. The current touch conversion also marks converted contacts as primary; do not use `IsPrimary` as your only mechanism for choosing the first finger. For a single-contact control, remember the first accepted ID until that sequence ends.

## Capture only what your surface owns

The pad immediately captures a `Drag` gesture because drawing contacts is its entire job. A button inside a scroller should normally begin with a tentative tap so the parent can take over when movement becomes scrolling. Otherwise a finger placed on a button can prevent the page from scrolling.

For a two-finger gesture, wait until you have two distinct active IDs, measure their initial distance and midpoint, and update relative to those values. Handle either contact ending; do not keep applying the old pair's scale after one finger disappears. Keep single-pointer navigation available alongside multitouch actions.

## Check the real target

Desktop phone emulation translates desktop input into mobile-style input; it does not prove that native multitouch, pressure, cancellation, or soft-keyboard behavior works on a phone. Browser pointer input and native touch adapters also supply different amounts of device detail.

Test a contact interrupted by navigation, a second contact arriving mid-drag, and system cancellation. Use large hit areas and visible pressed feedback. Continue with [gesture negotiation](../gestures/index.md) before combining custom touch controls and scrolling.
