awaitHorizontalPointerSlopOrCancellation
Function
Common
suspend fun AwaitPointerEventScope.awaitHorizontalPointerSlopOrCancellation(
pointerId: PointerId,
pointerType: PointerType,
onPointerSlopReached: (change: PointerInputChange, overSlop: Float) -> Unit,
) =
awaitPointerSlopOrCancellation(
pointerId = pointerId,
pointerType = pointerType,
onPointerSlopReached = { change, overSlop -> onPointerSlopReached(change, overSlop.x) },
orientation = Orientation.Horizontal,
)
Waits for horizontal 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 awaitHorizontalPointerSlopOrCancellation
is called, then null
is returned.
onPointerSlopReached
is called after pointerType
's touch slop motion in the horizontal
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. |