pub trait RenderScene {
type HitTarget: HitTestTarget + Clone;
// Required methods
fn clear(&mut self);
fn hit_test(&self, x: f32, y: f32) -> Vec<Self::HitTarget>;
fn find_target(&self, node_id: NodeId) -> Option<Self::HitTarget>;
// Provided methods
fn hit_test_nodes(&self, x: f32, y: f32) -> Vec<NodeId> ⓘ { ... }
fn collect_retained_visual_observation_nodes(
&self,
nodes: &mut HashSet<NodeId>,
) -> bool { ... }
}Expand description
Trait describing the minimal surface area required by the application shell to process pointer events and refresh the frame graph.
Required Associated Types§
type HitTarget: HitTestTarget + Clone
Required Methods§
fn clear(&mut self)
Sourcefn hit_test(&self, x: f32, y: f32) -> Vec<Self::HitTarget>
fn hit_test(&self, x: f32, y: f32) -> Vec<Self::HitTarget>
Performs hit testing at the given coordinates. Returns hit targets ordered by z-index (top-to-bottom).
Sourcefn find_target(&self, node_id: NodeId) -> Option<Self::HitTarget>
fn find_target(&self, node_id: NodeId) -> Option<Self::HitTarget>
Finds a hit target by NodeId with fresh geometry from the current scene.
This is the key method for HitPathTracker-style gesture handling:
- On PointerDown, we cache NodeIds (not geometry)
- On Move/Up/Cancel, we call this to get fresh HitTarget with current geometry
- Handler closures are preserved (same Rc), so internal state survives
Returns None if the node no longer exists in the scene (e.g., removed during gesture).
Provided Methods§
Sourcefn hit_test_nodes(&self, x: f32, y: f32) -> Vec<NodeId> ⓘ
fn hit_test_nodes(&self, x: f32, y: f32) -> Vec<NodeId> ⓘ
Returns NodeIds of all hit regions at the given coordinates.
This is a convenience method equivalent to hit_test().map(|h| h.node_id()).
Sourcefn collect_retained_visual_observation_nodes(
&self,
nodes: &mut HashSet<NodeId>,
) -> bool
fn collect_retained_visual_observation_nodes( &self, nodes: &mut HashSet<NodeId>, ) -> bool
Replaces the set with retained visual observation owners, preserving its capacity. Returns whether the scene provides this information.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".