pub struct SceneSpatialTree {
spatial_nodes: Vec<SceneSpatialNode>,
root_reference_frame_index: SpatialNodeIndex,
updates: SpatialTreeUpdates,
}Expand description
The representation of the spatial tree during scene building, which is mostly write-only, with a small number of queries for snapping, picture cache building.
Each SceneBuilder::build call calls reset() to start the tree fresh,
then emits a complete list of SpatialTreeUpdate::Insert ops that the
frame-side SpatialTree::apply_updates consumes verbatim.
Fields§
§spatial_nodes: Vec<SceneSpatialNode>Nodes which determine the positions (offsets and transforms) for primitives and clips.
root_reference_frame_index: SpatialNodeIndex§updates: SpatialTreeUpdatesImplementations§
Source§impl SceneSpatialTree
impl SceneSpatialTree
pub fn new() -> Self
Sourcepub fn reset(&mut self)
pub fn reset(&mut self)
Reset the tree to an empty state with just the root reference frame. Called at the start of each scene build.
fn add_root_reference_frame(&mut self)
pub fn is_root_coord_system(&self, index: SpatialNodeIndex) -> bool
Sourcepub fn end_frame_and_get_pending_updates(&mut self) -> SpatialTreeUpdates
pub fn end_frame_and_get_pending_updates(&mut self) -> SpatialTreeUpdates
Complete building this scene, return the updates to apply to the frame spatial tree
Sourcepub fn is_ancestor(
&self,
maybe_parent: SpatialNodeIndex,
maybe_child: SpatialNodeIndex,
) -> bool
pub fn is_ancestor( &self, maybe_parent: SpatialNodeIndex, maybe_child: SpatialNodeIndex, ) -> bool
Check if a given spatial node is an ancestor of another spatial node.
Sourcepub fn find_scroll_root(
&self,
spatial_node_index: SpatialNodeIndex,
allow_sticky_frames: bool,
) -> SpatialNodeIndex
pub fn find_scroll_root( &self, spatial_node_index: SpatialNodeIndex, allow_sticky_frames: bool, ) -> SpatialNodeIndex
Find the spatial node that is the scroll root for a given spatial node. A scroll root is the first spatial node when found travelling up the spatial node tree that is an explicit scroll frame.
Sourcepub fn root_reference_frame_index(&self) -> SpatialNodeIndex
pub fn root_reference_frame_index(&self) -> SpatialNodeIndex
The root reference frame, which is the true root of the SpatialTree.
fn add_spatial_node(&mut self, node: SceneSpatialNode) -> SpatialNodeIndex
pub fn add_reference_frame( &mut self, parent_index: SpatialNodeIndex, transform_style: TransformStyle, source_transform: PropertyBinding<LayoutTransform>, kind: ReferenceFrameKind, origin_in_parent_reference_frame: LayoutVector2D, pipeline_id: PipelineId, is_pipeline_root: bool, ) -> SpatialNodeIndex
pub fn add_scroll_frame( &mut self, parent_index: SpatialNodeIndex, external_id: ExternalScrollId, pipeline_id: PipelineId, frame_rect: &LayoutRect, content_size: &LayoutSize, frame_kind: ScrollFrameKind, external_scroll_offset: LayoutVector2D, scroll_offset_generation: APZScrollGeneration, has_scroll_linked_effect: HasScrollLinkedEffect, ) -> SpatialNodeIndex
pub fn add_sticky_frame( &mut self, parent_index: SpatialNodeIndex, sticky_frame_info: StickyFrameInfo, pipeline_id: PipelineId, ) -> SpatialNodeIndex
Trait Implementations§
Source§impl Serialize for SceneSpatialTree
impl Serialize for SceneSpatialTree
Source§impl SpatialNodeContainer for SceneSpatialTree
impl SpatialNodeContainer for SceneSpatialTree
Source§fn get_node_info(&self, index: SpatialNodeIndex) -> SpatialNodeInfo<'_>
fn get_node_info(&self, index: SpatialNodeIndex) -> SpatialNodeInfo<'_>
fn get_snapping_info( &self, parent_index: Option<SpatialNodeIndex>, ) -> Option<ScaleOffset>
Auto Trait Implementations§
impl Freeze for SceneSpatialTree
impl RefUnwindSafe for SceneSpatialTree
impl Send for SceneSpatialTree
impl Sync for SceneSpatialTree
impl Unpin for SceneSpatialTree
impl UnsafeUnpin for SceneSpatialTree
impl UnwindSafe for SceneSpatialTree
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more