awaitVerticalPointerSlopOrCancellation

Function

Common
suspend fun AwaitPointerEventScope.awaitVerticalPointerSlopOrCancellation(
    pointerId: PointerId,
    pointerType: PointerType,
    onPointerSlopReached: (change: PointerInputChange, overSlop: Float) -> Unit,
) =
    awaitPointerSlopOrCancellation(
        pointerId = pointerId,
        pointerType = pointerType,
        onPointerSlopReached = { change, overSlop -> onPointerSlopReached(change, overSlop.y) },
        orientation = Orientation.Vertical,
    )

Waits for vertical drag motion to pass pointerType's 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 awaitVerticalPointerSlopOrCancellation is called, then null is returned.

onPointerSlopReached is called after ViewConfiguration.touchSlop motion in the vertical direction with the change that caused the motion beyond touch slop and the pixels beyond touch slop. onPointerSlopReached 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.

Returns

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