Skip to main content

PointerInputNode

Trait PointerInputNode 

Source
pub trait PointerInputNode: ModifierNode {
    // Provided methods
    fn on_pointer_event(
        &mut self,
        _context: &mut dyn ModifierNodeContext,
        _event: &PointerEvent,
    ) -> bool { ... }
    fn hit_test(&self, _x: f32, _y: f32) -> bool { ... }
    fn pointer_input_handler(&self) -> Option<Rc<dyn Fn(PointerEvent)>> { ... }
}
Expand description

Marker trait for pointer input modifier nodes.

Pointer input nodes participate in hit-testing and pointer event dispatch. They can intercept pointer events and handle them before they reach the wrapped content.

Provided Methods§

Source

fn on_pointer_event( &mut self, _context: &mut dyn ModifierNodeContext, _event: &PointerEvent, ) -> bool

Called when a pointer event occurs within the bounds of this node. Returns true if the event was consumed and should not propagate further.

Source

fn hit_test(&self, _x: f32, _y: f32) -> bool

Returns true if this node should participate in hit-testing for the given pointer position.

Source

fn pointer_input_handler(&self) -> Option<Rc<dyn Fn(PointerEvent)>>

Returns an event handler closure if the node wants to participate in pointer dispatch.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§