pub struct UiSurface {
pub root_entity_to_viewport_node: EntityHashMap<NodeId>,
/* private fields */
}Fields§
§root_entity_to_viewport_node: EntityHashMap<NodeId>Implementations§
Source§impl UiSurface
impl UiSurface
Sourcepub fn upsert_node(
&mut self,
layout_context: &LayoutContext,
entity: Entity,
node: &Node,
new_node_context: Option<NodeMeasure>,
)
pub fn upsert_node( &mut self, layout_context: &LayoutContext, entity: Entity, node: &Node, new_node_context: Option<NodeMeasure>, )
Retrieves the Taffy node associated with the given UI node entity and updates its style. If no associated Taffy node exists a new Taffy node is inserted into the Taffy layout.
Sourcepub fn update_node_context(
&mut self,
entity: Entity,
context: NodeMeasure,
) -> Option<()>
pub fn update_node_context( &mut self, entity: Entity, context: NodeMeasure, ) -> Option<()>
Update the MeasureFunc of the taffy node corresponding to the given Entity if the node exists.
Sourcepub fn update_children(
&mut self,
entity: Entity,
children: impl Iterator<Item = Entity>,
)
pub fn update_children( &mut self, entity: Entity, children: impl Iterator<Item = Entity>, )
Update the children of the taffy node corresponding to the given Entity.
Sourcepub fn try_remove_children(&mut self, entity: Entity)
pub fn try_remove_children(&mut self, entity: Entity)
Removes children from the entity’s taffy node if it exists. Does nothing otherwise.
Sourcepub fn try_remove_node_context(&mut self, entity: Entity)
pub fn try_remove_node_context(&mut self, entity: Entity)
Removes the measure from the entity’s taffy node if it exists. Does nothing otherwise.
Sourcepub fn get_or_insert_taffy_viewport_node(
&mut self,
ui_root_entity: Entity,
) -> NodeId
pub fn get_or_insert_taffy_viewport_node( &mut self, ui_root_entity: Entity, ) -> NodeId
Gets or inserts an implicit taffy viewport node corresponding to the given UI root entity
Sourcepub fn compute_layout<'a>(
&mut self,
ui_root_entity: Entity,
render_target_resolution: UVec2,
buffer_query: &'a mut Query<'_, '_, &mut ComputedTextBlock>,
font_system: &'a mut CosmicFontSystem,
)
pub fn compute_layout<'a>( &mut self, ui_root_entity: Entity, render_target_resolution: UVec2, buffer_query: &'a mut Query<'_, '_, &mut ComputedTextBlock>, font_system: &'a mut CosmicFontSystem, )
Compute the layout for the given implicit taffy viewport node
Sourcepub fn remove_entities(&mut self, entities: impl IntoIterator<Item = Entity>)
pub fn remove_entities(&mut self, entities: impl IntoIterator<Item = Entity>)
Removes each entity from the internal map and then removes their associated nodes from taffy
Sourcepub fn get_layout(
&mut self,
entity: Entity,
use_rounding: bool,
) -> Result<(Layout, Vec2), LayoutError>
pub fn get_layout( &mut self, entity: Entity, use_rounding: bool, ) -> Result<(Layout, Vec2), LayoutError>
Get the layout geometry for the taffy node corresponding to the ui node Entity.
Does not compute the layout geometry, compute_window_layouts should be run before using this function.
On success returns a pair consisting of the final resolved layout values after rounding
and the size of the node after layout resolution but before rounding.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for UiSurface
impl !RefUnwindSafe for UiSurface
impl Send for UiSurface
impl Sync for UiSurface
impl Unpin for UiSurface
impl !UnwindSafe for UiSurface
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
Source§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Creates Self using default().
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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