{% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %} {% include "_shared/_reference-head-tags.html" %}

SuspendingPointerInputModifierNode

public sealed interface SuspendingPointerInputModifierNode extends PointerInputModifierNode


Extends PointerInputModifierNode with a handler to execute asynchronously when an event occurs and a function to reset that handler (cancels the existing coroutine and essentially resets the handler's execution). Note: The handler still executes lazily, meaning nothing will be done until a new event comes in.

Summary

Public methods

abstract @ExtensionFunctionType @NonNull SuspendFunction1<@NonNull PointerInputScopeUnit>

Handler for pointer input events.

abstract void

Resets the underlying coroutine used to run the handler for input pointer events.

abstract void
setPointerInputHandler(
    @ExtensionFunctionType @NonNull SuspendFunction1<@NonNull PointerInputScopeUnit> pointerInputHandler
)

Handler for pointer input events.

Inherited methods

From androidx.compose.ui.node.DelegatableNode
abstract @NonNull Modifier.Node

A reference of the Modifier.Node that holds this node's position in the node hierarchy.

From androidx.compose.ui.node.PointerInputModifierNode
default boolean

Intercept pointer input that children receive even if the pointer is out of bounds.

abstract void

Invoked to notify the handler that no more calls to PointerInputModifierNode will be made, until at least new pointers exist.

default void

Invoked when the density (pixels per inch for the screen) changes.

abstract void
onPointerEvent(
    @NonNull PointerEvent pointerEvent,
    @NonNull PointerEventPass pass,
    @NonNull IntSize bounds
)

Invoked when pointers that previously hit this PointerInputModifierNode have changed.

default void

Invoked when the view configuration (touch slop size, minimum touch target, tap timing) changes which means the composable UI the pointer input block is tied to has changed and the new UI might impact the location of pointer input events (x and y).

default boolean

If false, then this PointerInputModifierNode will not allow siblings under it to respond to events.

Public methods

getPointerInputHandler

abstract @ExtensionFunctionType @NonNull SuspendFunction1<@NonNull PointerInputScopeUnitgetPointerInputHandler()

Handler for pointer input events. When changed, any previously executing pointerInputHandler will be canceled.

resetPointerInputHandler

abstract void resetPointerInputHandler()

Resets the underlying coroutine used to run the handler for input pointer events. This should be called whenever a large change has been made that forces the gesture detection to be completely invalid.

For example, if pointerInputHandler has different modes for detecting a gesture (long press, double click, etc.), and by switching the modes, any currently-running gestures are no longer valid.

setPointerInputHandler

abstract void setPointerInputHandler(
    @ExtensionFunctionType @NonNull SuspendFunction1<@NonNull PointerInputScopeUnit> pointerInputHandler
)

Handler for pointer input events. When changed, any previously executing pointerInputHandler will be canceled.