pub struct LayoutRect {
pub x: f64,
pub y: f64,
pub w: f64,
pub h: f64,
}Expand description
A rectangle in layout space (f64 for precision during subdivision).
Fields§
§x: f64§y: f64§w: f64§h: f64Implementations§
Source§impl LayoutRect
impl LayoutRect
pub fn new(x: f64, y: f64, w: f64, h: f64) -> Self
pub fn area(&self) -> f64
pub fn shorter_side(&self) -> f64
pub fn is_wide(&self) -> bool
Sourcepub fn is_visible(&self, min_dimension: f64) -> bool
pub fn is_visible(&self, min_dimension: f64) -> bool
Whether this rect is large enough to be visible.
Sourcepub fn inset(&self, amount: f64) -> Self
pub fn inset(&self, amount: f64) -> Self
Inset the rectangle by amount on all sides. Returns a zero-area rect
if the inset would collapse it.
Sourcepub fn split_strip(&self, fraction: f64) -> (Self, Self)
pub fn split_strip(&self, fraction: f64) -> (Self, Self)
Split off a strip from the shorter side direction.
fraction is the proportion of area the strip occupies (0..1).
Returns (strip, remainder).
Trait Implementations§
Source§impl Clone for LayoutRect
impl Clone for LayoutRect
Source§fn clone(&self) -> LayoutRect
fn clone(&self) -> LayoutRect
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for LayoutRect
impl Debug for LayoutRect
Source§impl PartialEq for LayoutRect
impl PartialEq for LayoutRect
impl Copy for LayoutRect
impl StructuralPartialEq for LayoutRect
Auto Trait Implementations§
impl Freeze for LayoutRect
impl RefUnwindSafe for LayoutRect
impl Send for LayoutRect
impl Sync for LayoutRect
impl Unpin for LayoutRect
impl UnsafeUnpin for LayoutRect
impl UnwindSafe for LayoutRect
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