Incular logoIncular
API ReferenceLayout Values

Rect

Origin plus size with hit and intersection tests.

use incular::prelude::*;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let area = Rect::from_origin_size(Offset::ZERO, Size::new(200.0, 120.0));
    let hit = area.contains(Offset::new(10.0, 10.0));
    let app = Application::new(move |_cx| {
        Container::builder()
            .padding(EdgeInsets::all(24.0))
            .alignment(Alignment::CENTER)
            .child(Text::new(format!("hit: {hit}")))
            .build()
            .into()
    })?;
    incular::run(app)?;
    Ok(())
}
MemberKindNotes
from_origin_sizeConstructorOrigin + size pair
origin / sizeFieldsPublic
containsQueryInclusive bounds hit test
intersectsQueryOverlap check
intersectionQueryOverlapping rect or None

Supports Lerp. Used by Canvas clipping, RRect, and TransientPlacement.

Related: Size, Offset.