pub struct SceneTree { /* private fields */ }Expand description
Flat generation-indexed arena holding the entire retained UI scene graph.
Implementations§
Source§impl SceneTree
Core retained scene graph mutation and traversal operations.
impl SceneTree
Core retained scene graph mutation and traversal operations.
Sourcepub fn create_node(&mut self, kind: NodeKind, style: Style) -> NodeId
pub fn create_node(&mut self, kind: NodeKind, style: Style) -> NodeId
Sourcepub fn create_view(&mut self, style: Style) -> NodeId
pub fn create_view(&mut self, style: Style) -> NodeId
Sourcepub fn create_text(&mut self, content: String, style: Style) -> NodeId
pub fn create_text(&mut self, content: String, style: Style) -> NodeId
Sourcepub fn create_input(&mut self, state: InputNodeState, style: Style) -> NodeId
pub fn create_input(&mut self, state: InputNodeState, style: Style) -> NodeId
Sourcepub fn create_image(&mut self, buffer: ImageBuffer, style: Style) -> NodeId
pub fn create_image(&mut self, buffer: ImageBuffer, style: Style) -> NodeId
Sourcepub fn create_scroll_view(&mut self, style: Style) -> NodeId
pub fn create_scroll_view(&mut self, style: Style) -> NodeId
Sourcepub fn create_canvas(
&mut self,
style: Style,
painter: CanvasDrawCallback,
) -> NodeId
pub fn create_canvas( &mut self, style: Style, painter: CanvasDrawCallback, ) -> NodeId
Sourcepub fn create_portal(&mut self, style: Style) -> NodeId
pub fn create_portal(&mut self, style: Style) -> NodeId
Sourcepub fn create_fragment(&mut self) -> NodeId
pub fn create_fragment(&mut self) -> NodeId
Sourcepub fn get_node_mut(&mut self, id: NodeId) -> Option<&mut SceneNode>
pub fn get_node_mut(&mut self, id: NodeId) -> Option<&mut SceneNode>
Sourcepub fn live_node_count(&self) -> usize
pub fn live_node_count(&self) -> usize
Sourcepub fn append_child(&mut self, parent: NodeId, child: NodeId)
pub fn append_child(&mut self, parent: NodeId, child: NodeId)
Appends child to parent and marks layout and paint dirty upward.
§Arguments
&Self- Mutable scene tree.NodeId- Parent container node.NodeId- Child node to attach.
Sourcepub fn append_children(&mut self, parent: NodeId, children: &[NodeId])
pub fn append_children(&mut self, parent: NodeId, children: &[NodeId])
Appends multiple children to parent in a single dirty-marking pass with pre-reserved capacity.
§Arguments
&Self- Mutable scene tree.NodeId- Parent container node.&[NodeId]- Ordered child nodes to append.
Sourcepub fn replace_children(&mut self, parent: NodeId, new_children: Vec<NodeId>)
pub fn replace_children(&mut self, parent: NodeId, new_children: Vec<NodeId>)
Replaces all children of parent with new_children, disposing previous subtrees cleanly.
§Arguments
&Self- Mutable scene tree.NodeId- Parent container node.Vec<NodeId>- Replacement ordered children.
Sourcepub fn set_style(&mut self, id: NodeId, style: Style)
pub fn set_style(&mut self, id: NodeId, style: Style)
Surgically updates a node’s Style, only marking layout dirty when LayoutStyle changed.
§Arguments
&Self- Mutable scene tree.NodeId- Target node handle.Style- Replacement compiled style.
Sourcepub fn set_text(&mut self, id: NodeId, text: String)
pub fn set_text(&mut self, id: NodeId, text: String)
Surgically updates the UTF-8 string of a NodeKind::Text node.
§Arguments
&Self- Mutable scene tree.NodeId- Target text node handle.String- Replacement text string.
Sourcepub fn set_scroll_offset(&mut self, id: NodeId, offset: Point)
pub fn set_scroll_offset(&mut self, id: NodeId, offset: Point)
Updates scroll offset on a scroll container without triggering full subtree re-layout.
§Arguments
&Self- Mutable scene tree.NodeId- Target scroll container handle.Point- New scroll offset clamped to content bounds.
Sourcepub fn set_virtual_scroll(
&mut self,
id: NodeId,
scroll_y: f32,
content_height: f32,
)
pub fn set_virtual_scroll( &mut self, id: NodeId, scroll_y: f32, content_height: f32, )
Records virtualized scroll progress (scroll_y, content_height) on id for overlay scrollbar rendering.
§Arguments
&Self- Mutable scene tree.NodeId- Target virtualized scroll container.f32- Active virtual vertical scroll offset in logical pixels.f32- Full virtualized content height in logical pixels.
Sourcepub fn node_screen_bounds(&self, id: NodeId) -> Option<Rect>
pub fn node_screen_bounds(&self, id: NodeId) -> Option<Rect>
Sourcepub fn start_transition(&mut self, transition: NodeTransition)
pub fn start_transition(&mut self, transition: NodeTransition)
Starts or smoothly retargets a paint/transform transition on transition.get_node().
§Arguments
&Self- Mutable scene tree.NodeTransition- Transition specification to run.
Sourcepub fn tick_transitions(&mut self, dt_secs: f32) -> bool
pub fn tick_transitions(&mut self, dt_secs: f32) -> bool
Sourcepub fn has_active_transitions(&self) -> bool
pub fn has_active_transitions(&self) -> bool
Sourcepub fn attach_lifecycle(&mut self, id: NodeId, hook: Rc<dyn Lifecycle>)
pub fn attach_lifecycle(&mut self, id: NodeId, hook: Rc<dyn Lifecycle>)
Attaches a Lifecycle hook observer onto id for mount, activate, freeze, resume, unmount, and destroy dispatch.
§Arguments
&Self- Mutable scene tree.NodeId- Target scene node handle.Rc<dyn Lifecycle>- Shared lifecycle hook observer.
Sourcepub fn cancel_subtree_transitions(&mut self, root: NodeId)
pub fn cancel_subtree_transitions(&mut self, root: NodeId)
Cancels any active paint/transform transitions targeting nodes within the subtree rooted at root.
§Arguments
&Self- Mutable scene tree.NodeId- Subtree root handle.
Sourcepub fn attach_scope(&mut self, id: NodeId, scope: Scope)
pub fn attach_scope(&mut self, id: NodeId, scope: Scope)
Attaches a reactive Scope to id so it automatically disposes when the node unmounts.
§Arguments
&Self- Mutable scene tree.NodeId- Target node handle.Scope- Reactive ownership scope.
Sourcepub fn mark_dirty(&mut self, id: NodeId, mask: u16)
pub fn mark_dirty(&mut self, id: NodeId, mask: u16)
Marks id dirty with mask and propagates subtree dirty bits to ancestors in O(depth).
§Arguments
&Self- Mutable scene tree.NodeId- Mutated node handle.u16- Dirty flag bits to set.
Sourcepub fn is_node_visible(&self, id: NodeId) -> bool
pub fn is_node_visible(&self, id: NodeId) -> bool
Sourcepub fn collect_paint_damage(&mut self, scale: f32) -> DamageRegion
pub fn collect_paint_damage(&mut self, scale: f32) -> DamageRegion
Sourcepub fn dispose_subtree_collect(&mut self, id: NodeId) -> DisposedSubtreePayload
pub fn dispose_subtree_collect(&mut self, id: NodeId) -> DisposedSubtreePayload
Recursively detaches and recycles id, returning all owned Scopes and Lifecycle observers for borrow-safe finalization.
§Arguments
&Self- Mutable scene tree.NodeId- Subtree root handle to dispose.
§Returns
DisposedSubtreePayload- Collected scopes and lifecycle observers to finalize outside any borrow.
Sourcepub fn dispose_subtree(&mut self, id: NodeId)
pub fn dispose_subtree(&mut self, id: NodeId)
Recursively removes and disposes id, recycling all arena slots, running lifecycle hooks, and disposing scopes.
§Arguments
&Self- Mutable scene tree.NodeId- Subtree root handle to dispose.