onCapturedPointerEvent

Captures button locally when its press reaches this modifier and sends typed gesture notifications to its owner. Matching presses, movement, scrolling, and matching-button drag/release events are consumed immediately. Other buttons continue ordinary dispatch. Captured coordinates may lie outside the modifier bounds. Changing the button leaves an active gesture attached to its original subscription until release or cancellation. A remote subscription change retires its endpoints, so that old gesture cannot invoke replacement handlers. onCancel runs on the owner thread for interrupted gestures; it is not called for an ordinary release.


Handles pointer events and captures the button whose press this handler consumes.

Only one handler may own capture in a tree; a press cannot replace another active capture. Moves and matching-button drags or releases then reach only this entry, including outside its bounds or ancestor clips, and stop propagation regardless of the returned result. Coordinates remain relative to the latest committed layout without clamping, while other buttons, scrolling, and hover use ordinary hit testing. A matching release clears capture before callback and never calls onCancel. Removal, replacement, unplacement, input reset, detachment, close, and failure clear capture before calling onCancel once, before this entry is disposed. Updating callbacks in the same retained modifier position preserves capture and does not invalidate frame phases. Both callbacks run on the owning tree thread; descriptions retain them until replacement or disposal.

Return

this chain with one appended active capture-capable pointer node.

Parameters

onCancel

callback receiving the starting button of an interrupted gesture.

callback

callback receiving the immutable tree event and current modifier-local position.

Throws

when either callback fails; the owning tree preserves the primary failure and still attempts remaining cleanup.