pub struct UiElement {
pub anchor: Anchor,
pub offset: Vec2,
pub size: Vec2,
pub scale_mode: ScaleMode,
pub visible: bool,
pub z_order: i32,
}Expand description
UI Element component for responsive layout
Fields§
§anchor: AnchorAnchor point for positioning
offset: Vec2Offset from anchor point
size: Vec2Size of the element
scale_mode: ScaleModeHow the element scales
visible: boolWhether the element is visible
z_order: i32Z-order for layering (higher = on top)
Implementations§
Source§impl UiElement
impl UiElement
Sourcepub const fn with_anchor(self, anchor: Anchor) -> Self
pub const fn with_anchor(self, anchor: Anchor) -> Self
Sets the anchor
Sourcepub const fn with_offset(self, offset: Vec2) -> Self
pub const fn with_offset(self, offset: Vec2) -> Self
Sets the offset
Sourcepub const fn with_scale_mode(self, mode: ScaleMode) -> Self
pub const fn with_scale_mode(self, mode: ScaleMode) -> Self
Sets the scale mode
Sourcepub const fn with_z_order(self, z: i32) -> Self
pub const fn with_z_order(self, z: i32) -> Self
Sets the z-order
Sourcepub fn calculate_position(&self, container_size: Vec2) -> Vec2
pub fn calculate_position(&self, container_size: Vec2) -> Vec2
Calculates the actual position given a container size
Trait Implementations§
Source§impl<'de> Deserialize<'de> for UiElement
impl<'de> Deserialize<'de> for UiElement
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for UiElement
Auto Trait Implementations§
impl Freeze for UiElement
impl RefUnwindSafe for UiElement
impl Send for UiElement
impl Sync for UiElement
impl Unpin for UiElement
impl UnwindSafe for UiElement
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