Expand description
Represents an (axis-aligned) rectangle. Axis-aligned means that you can’t rotate it.
Fields
pos: Vec2
size: Vec2
Implementations
impl Rect
impl Rect
pub fn intersects(&self, r: Rect) -> bool
pub fn add_padding(self, padding: Padding) -> Rect
pub fn add_padding(self, padding: Padding) -> Rect
This returns the Rect
for if you’d add padding all around the given Rect
.
This means that the pos
will move according to the left/top padding, and the size will be adjusted
based on the sum of the vertical/horizontal paddings.
If you just want to adjust the size while keeping pos
the same, you can simply add the desired
dimensions to size
.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Rect
impl UnwindSafe for Rect
Blanket Implementations
Mutably borrows from an owned value. Read more