pub struct UiRect {
pub min: [f32; 2],
pub size: [f32; 2],
}Fields§
§min: [f32; 2]§size: [f32; 2]Implementations§
Source§impl Rect
impl Rect
pub fn valid(self) -> bool
Sourcepub fn contains(self, p: [f32; 2]) -> bool
pub fn contains(self, p: [f32; 2]) -> bool
Half-open bounds give adjacent widgets an unambiguous shared edge.
pub fn intersect(self, other: Rect) -> Option<Rect>
Sourcepub fn inset(self, insets: [f32; 4]) -> Result<Rect, UiError>
pub fn inset(self, insets: [f32; 4]) -> Result<Rect, UiError>
Inset by left, top, right, bottom, keeping the result inside this rectangle. If opposite insets exceed the extent, scale that pair proportionally and collapse the axis to zero. Negative/non-finite values are rejected.
use ferravex_play::ui::Rect;
let panel = Rect { min: [10., 20.], size: [100., 40.] };
assert_eq!(panel.inset([8.; 4])?.size, [84., 24.]);
assert_eq!(panel.inset([80., 0., 80., 0.])?.size, [0., 40.]);Trait Implementations§
impl Copy for Rect
impl StructuralPartialEq for Rect
Auto Trait Implementations§
impl Freeze for Rect
impl RefUnwindSafe for Rect
impl Send for Rect
impl Sync for Rect
impl Unpin for Rect
impl UnwindSafe for Rect
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