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


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


<h2 id="awaitdragorcancellation-pointerid">awaitDragOrCancellation</h2>

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


```kotlin
suspend fun AwaitPointerEventScope.awaitDragOrCancellation(
    pointerId: PointerId
): PointerInputChange?
```


Reads pointer input events until a drag is detected or all pointers are up. When the final
pointer is raised, the up event is returned. When a drag event is detected, the drag change will
be returned. Note that if `pointerId` has been raised, another pointer that is down will be used,
if available, so the returned `PointerInputChange.id` may differ from `pointerId`. If the
position change in the any direction has been consumed by the `PointerEventPass.Main` pass, then
the drag is considered canceled and `null` is returned. If `pointerId` is not down when
`awaitDragOrCancellation` is called, then `null` is returned.

Example Usage: