pub struct AspectRatio { /* private fields */ }Expand description
Maintain aspect ratio wrapper
Constrains content to a specific aspect ratio.
Inspired by SwiftUI’s aspectRatio modifier.
§Example
use armas_basic::layout::AspectRatio;
// 16:9 aspect ratio
AspectRatio::new(16.0 / 9.0)
.show(ui, |ui| {
ui.label("16:9 content");
});
// Square (1:1)
AspectRatio::square()
.show(ui, |ui| {
ui.label("Square content");
});Implementations§
Source§impl AspectRatio
impl AspectRatio
Sourcepub fn widescreen() -> Self
pub fn widescreen() -> Self
Create 16:9 aspect ratio (widescreen)
Sourcepub const fn content_mode(self, mode: ContentMode) -> Self
pub const fn content_mode(self, mode: ContentMode) -> Self
Set content mode (fill or fit)
Trait Implementations§
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