pub struct LayoutRect {
pub x: i32,
pub y: i32,
pub width: u16,
pub height: u16,
}Expand description
A rectangle with signed origin and unsigned dimensions.
Used throughout the engine to represent both screen-space regions and floating-window geometry where off-screen coordinates are valid.
Fields§
§x: i32§y: i32§width: u16§height: u16Implementations§
Source§impl LayoutRect
impl LayoutRect
Sourcepub fn center(&self) -> (i32, i32)
pub fn center(&self) -> (i32, i32)
Centre point of the rectangle, rounding down on odd dimensions.
Sourcepub fn intersection(&self, other: LayoutRect) -> LayoutRect
pub fn intersection(&self, other: LayoutRect) -> LayoutRect
Compute the intersection of two rectangles.
Sourcepub fn contains<T: Into<i32>>(&self, col: T, row: T) -> bool
pub fn contains<T: Into<i32>>(&self, col: T, row: T) -> bool
Check if a point is inside the rectangle. Generic over coordinate type - accepts both i32 and u16.
pub fn clamp(self, bounds: LayoutRect) -> LayoutRect
pub fn visible_portion(self, bounds: LayoutRect) -> LayoutRect
pub fn intersects(self, other: LayoutRect) -> bool
Sourcepub fn screen_to_local_point(&self, col: u16, row: u16) -> (i32, i32)
pub fn screen_to_local_point(&self, col: u16, row: u16) -> (i32, i32)
Subtract the rect origin from screen coordinates to get local deltas.
CATEGORY 3 — Scalar Geometry. Pure arithmetic helper for text_renderer.rs and mouse_coord.rs. Returns signed deltas that may be negative (positions outside the rect).
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 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for LayoutRect
Source§impl Debug for LayoutRect
impl Debug for LayoutRect
Source§impl Default for LayoutRect
impl Default for LayoutRect
Source§fn default() -> LayoutRect
fn default() -> LayoutRect
Returns the “default value” for a type. Read more
impl Eq for LayoutRect
Source§impl PartialEq for LayoutRect
impl PartialEq 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