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)>> { ... }
fn layout_size_sink(&self) -> Option<Rc<Cell<Size>>> { ... }
}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§
Sourcefn on_pointer_event(
&mut self,
_context: &mut dyn ModifierNodeContext,
_event: &PointerEvent,
) -> bool
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.
Sourcefn hit_test(&self, _x: f32, _y: f32) -> bool
fn hit_test(&self, _x: f32, _y: f32) -> bool
Returns true if this node should participate in hit-testing for the given pointer position.
Sourcefn pointer_input_handler(&self) -> Option<Rc<dyn Fn(PointerEvent)>>
fn pointer_input_handler(&self) -> Option<Rc<dyn Fn(PointerEvent)>>
Returns an event handler closure if the node wants to participate in pointer dispatch.
Sourcefn layout_size_sink(&self) -> Option<Rc<Cell<Size>>>
fn layout_size_sink(&self) -> Option<Rc<Cell<Size>>>
Returns the cell this node reads its owning layout node’s resolved size
from, if it exposes a size to its handler (Compose’s
PointerInputScope.size).
The cell is shared with the node, so the layout pass publishes the size
into it once per pass and every read — including reads that happen
before any pointer event arrives — observes the current size. The size
is the node’s layout box in the same local coordinate space the
dispatched PointerEvent positions use, so
event.local_position / size is a well-defined fraction of the node.
Returns None for pointer nodes with no size-bearing scope.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".