ailloli_ui_core/geometry/
mod.rs

1//! Two-dimensional geometry in **logical pixel** space.
2//!
3//! Types here are used by layout, hit-testing, and clip propagation. GPU clip
4//! strategy (scissor vs stencil) is chosen in `ailloli_ui_render_wgpu`, not in this module.
5
6/// Axis-aligned and rounded local clip shapes.
7///
8/// # Examples
9///
10/// ```
11/// use ailloli_ui_core::geometry::clip_shape::ClipShape;
12/// use ailloli_ui_core::Rect;
13/// assert!(matches!(ClipShape::rect(Rect::new(0.0, 0.0, 1.0, 1.0)), ClipShape::Rect(_)));
14/// ```
15pub mod clip_shape;
16/// Parent-to-child minimum and maximum layout sizes.
17///
18/// # Examples
19///
20/// ```
21/// use ailloli_ui_core::geometry::constraints::Constraints;
22/// assert_eq!(Constraints::tight(10.0, 20.0).max_w, 10.0);
23/// ```
24pub mod constraints;
25/// Four-sided padding and margin values.
26///
27/// # Examples
28///
29/// ```
30/// use ailloli_ui_core::geometry::edge_insets::EdgeInsets;
31/// assert_eq!(EdgeInsets::all(2.0).horizontal(), 4.0);
32/// ```
33pub mod edge_insets;
34/// Two-dimensional translation vectors.
35///
36/// # Examples
37///
38/// ```
39/// use ailloli_ui_core::geometry::offset::Offset;
40/// assert_eq!(Offset::new(1.0, 2.0).x, 1.0);
41/// ```
42pub mod offset;
43/// Positions in logical coordinate spaces.
44///
45/// # Examples
46///
47/// ```
48/// use ailloli_ui_core::geometry::point::Point;
49/// assert_eq!(Point::new(1.0, 2.0).y, 2.0);
50/// ```
51pub mod point;
52/// Axis-aligned rectangles and intersection helpers.
53///
54/// # Examples
55///
56/// ```
57/// use ailloli_ui_core::geometry::rect::Rect;
58/// assert_eq!(Rect::new(0.0, 0.0, 2.0, 3.0).right(), 2.0);
59/// ```
60pub mod rect;
61/// Logical width and height pairs.
62///
63/// # Examples
64///
65/// ```
66/// use ailloli_ui_core::geometry::size::Size;
67/// assert!(!Size::new(2.0, 3.0).is_empty());
68/// ```
69pub mod size;
70
71pub use clip_shape::ClipShape;
72pub use constraints::Constraints;
73pub use edge_insets::EdgeInsets;
74pub use offset::Offset;
75pub use point::Point;
76pub use rect::Rect;
77pub use size::Size;