pub struct UiStyle {Show 14 fields
pub flex_direction: FlexDirection,
pub justify_content: Align,
pub align_items: Align,
pub width: Val,
pub height: Val,
pub min_width: Val,
pub min_height: Val,
pub max_width: Val,
pub max_height: Val,
pub padding: [f32; 4],
pub margin: [f32; 4],
pub gap: f32,
pub flex_grow: f32,
pub flex_shrink: f32,
}Expand description
UI 布局样式
Flexbox 属性集合,控制 UI 元素的布局行为。
§示例
use anvilkit_render::renderer::ui::{UiStyle, FlexDirection, Align, Val};
let style = UiStyle {
flex_direction: FlexDirection::Column,
justify_content: Align::Center,
align_items: Align::Center,
width: Val::Percent(100.0),
height: Val::Px(50.0),
..Default::default()
};Fields§
§flex_direction: FlexDirection§justify_content: Align§align_items: Align§width: Val§height: Val§min_width: Val§min_height: Val§max_width: Val§max_height: Val§padding: [f32; 4]§margin: [f32; 4]§gap: f32§flex_grow: f32§flex_shrink: f32Trait Implementations§
Auto Trait Implementations§
impl Freeze for UiStyle
impl RefUnwindSafe for UiStyle
impl Send for UiStyle
impl Sync for UiStyle
impl Unpin for UiStyle
impl UnsafeUnpin for UiStyle
impl UnwindSafe for UiStyle
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<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>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> 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)
Convert
&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)
Convert
&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> DowncastSync for T
impl<T> DowncastSync 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 data from the given World.