pub struct AspectRatio {
pub anchor: (Anchor, Anchor),
/* private fields */
}Expand description
Expands the horizontal or vertical dimensions of a child to maintain an aspect ratio.
An anchor must be specified to determine where the child should be placed after the aspect ratio is applied.
Once the child is added, it cannot be removed.
Fields§
§anchor: (Anchor, Anchor)The position to place the shrunken space. The child is then aligned within the new space.
Implementations§
Source§impl AspectRatio
impl AspectRatio
Sourcepub fn with_child(self, index: NodeIndex) -> Self
pub fn with_child(self, index: NodeIndex) -> Self
Sourcepub fn with_align(self, align: (Alignment, Alignment)) -> Self
pub fn with_align(self, align: (Alignment, Alignment)) -> Self
Set the horizontal and vertical alignment.
Sourcepub fn with_anchor(self, anchor: (Anchor, Anchor)) -> Self
pub fn with_anchor(self, anchor: (Anchor, Anchor)) -> Self
Set the horizontal and vertical anchor.
Sourcepub fn with_ratio(self, ratio: f32) -> Self
pub fn with_ratio(self, ratio: f32) -> Self
Trait Implementations§
Source§impl Default for AspectRatio
impl Default for AspectRatio
Source§impl UiNode for AspectRatio
impl UiNode for AspectRatio
Source§fn get_align_mut(&mut self) -> (&mut Alignment, &mut Alignment)
fn get_align_mut(&mut self) -> (&mut Alignment, &mut Alignment)
Get a mutable reference to the alignment of the node.
Source§fn calculate_min_size(&self, tree: &UiTree) -> (f32, f32)
fn calculate_min_size(&self, tree: &UiTree) -> (f32, f32)
Calculate the minimum size of the node. Read more
Source§fn calculate_rects(&self, cache: &NodeCache, tree: &UiTree) -> Vec<Rect>
fn calculate_rects(&self, cache: &NodeCache, tree: &UiTree) -> Vec<Rect>
Recalculate the position and size of child nodes, in the same order and count as
get_visible_children. Read moreSource§fn get_children(&self) -> Vec<NodeIndex>
fn get_children(&self) -> Vec<NodeIndex>
Get all children of the node, if applicable.
Auto Trait Implementations§
impl Freeze for AspectRatio
impl RefUnwindSafe for AspectRatio
impl Send for AspectRatio
impl Sync for AspectRatio
impl Unpin for AspectRatio
impl UnsafeUnpin for AspectRatio
impl UnwindSafe for AspectRatio
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
Mutably borrows from an owned value. Read more