<div class='type'>Function</div>


<a id='references'></a>


<h2 id="awaittouchsloporcancellation-pointerid-ontouchslopreached">awaitTouchSlopOrCancellation</h2>

<div class='sourceset sourceset-common'>Common</div>


```kotlin
suspend fun AwaitPointerEventScope.awaitTouchSlopOrCancellation(
    pointerId: PointerId,
    onTouchSlopReached: (change: PointerInputChange, overSlop: Offset) -> Unit,
): PointerInputChange?
```


Waits for drag motion to pass `touch slop`, using `pointerId` as the
pointer to examine. If `pointerId` is raised, another pointer from those that are down will be
chosen to lead the gesture, and if none are down, `null` is returned. If `pointerId` is not down
when `awaitTouchSlopOrCancellation` is called, then `null` is returned.

`onTouchSlopReached` is called after `ViewConfiguration.touchSlop` motion in the any direction
with the change that caused the motion beyond touch slop and the `Offset` beyond touch slop that
has passed. `onTouchSlopReached` should consume the position change if it accepts the motion. If
it does, then the method returns that `PointerInputChange`. If not, touch slop detection will
continue.


Example Usage:

#### Returns

| | |
| --- | --- |
|  | The `PointerInputChange` that was consumed in `onTouchSlopReached` or `null` if all pointers are raised before touch slop is detected or another gesture consumed the position change. |