Skip to main content

HitTestTarget

Trait HitTestTarget 

Source
pub trait HitTestTarget {
    // Required methods
    fn dispatch(&self, event: PointerEvent);
    fn node_id(&self) -> NodeId;

    // Provided methods
    fn dispatch_with_applier(
        &self,
        _applier: &mut MemoryApplier,
        event: PointerEvent,
    ) { ... }
    fn capture_path(&self) -> Vec<NodeId>  { ... }
}
Expand description

Trait implemented by hit-test targets stored inside a RenderScene.

Required Methods§

Source

fn dispatch(&self, event: PointerEvent)

Dispatches a pointer event to this target’s handlers.

Source

fn node_id(&self) -> NodeId

Returns the NodeId associated with this hit target. Used by HitPathTracker to cache stable identity instead of geometry.

Provided Methods§

Source

fn dispatch_with_applier( &self, _applier: &mut MemoryApplier, event: PointerEvent, )

Dispatches a pointer event using the current live node state when available.

Render-scene hit targets may cache closures from an older scene build. Pointer dispatch goes through this hook so implementations can resolve fresh handlers from the current applier while still using the target’s geometry snapshot.

Source

fn capture_path(&self) -> Vec<NodeId>

Returns the node capture path that should stay attached to this target’s gesture.

The default is just this target’s own node. Renderers can override this to include stable ancestor pointer-input nodes that must continue receiving Move/Up/Cancel even if the original descendant target is recycled.

Implementors§