androidx.compose.ui.input.pointer

AwaitPointerEventScope

Interface · from org.jetbrains.compose.ui:ui:1.12.2

No hand-written docs yet.

Receiver scope for awaiting pointer events in a call to PointerInputScope.awaitPointerEventScope.

interface AwaitPointerEventScope : Density

Is a

Properties

size

val size: IntSize

The measured size of the pointer input region. Input events will be reported with a coordinate space of (0, 0) to (size.width, size,height) as the input region, with (0, 0) indicating the upper left corner.

extendedTouchPadding

val extendedTouchPadding: Size

currentEvent

val currentEvent: PointerEvent

The PointerEvent from the most recent touch event.

viewConfiguration

val viewConfiguration: ViewConfiguration

The ViewConfiguration used to tune gesture detectors.

Functions

awaitPointerEvent

fun awaitPointerEvent(
    pass: PointerEventPass = PointerEventPass.Main,
): PointerEvent

Suspend until a PointerEvent is reported to the specified input pass. pass defaults to PointerEventPass.Main.

withTimeoutOrNull

fun <T> withTimeoutOrNull(
    timeMillis: Long,
    block: suspend AwaitPointerEventScope.() -> T,
): T?

Runs block and returns the result of block or null if timeMillis has passed before timeMillis.

withTimeout

fun <T> withTimeout(
    timeMillis: Long,
    block: suspend AwaitPointerEventScope.() -> T,
): T

Runs block and returns its results. An PointerEventTimeoutCancellationException is thrown if timeMillis has passed before block completes.

Library docs

Receiver scope for awaiting pointer events in a call to PointerInputScope.awaitPointerEventScope.

This is a restricted suspension scope. Code in this scope is always called un-dispatched and may only suspend for calls to awaitPointerEvent. These functions resume synchronously and the caller may mutate the result before the next await call to affect the next stage of the input processing pipeline.