onDrag

Handles every pointer drag that hits this modifier's laid-out bounds.

Drag events retain the held button and finite native displacement in addition to the current absolute position. Use onHover for distinct enter and exit transitions produced by both ordinary movement and dragging.

Return

this chain with one appended active drag handler.

Parameters

callback

callback receiving the typed event and modifier-local position and deciding propagation.

Throws

when callback fails during dispatch.


fun Modifier.onDrag(action: () -> Unit): Modifier(source)

Runs action for every pointer drag that hits this modifier without consuming the event.

Return

this chain with one appended non-consuming drag handler.

Parameters

action

synchronous action invoked on the owning tree thread.

Throws

when action fails during dispatch.