pub struct LayoutResult {
pub size: Size,
pub children: Vec<ChildLayout>,
pub paint_bounds: Rect,
pub visual_bounds: Rect,
pub overlay_hit_bounds: Vec<Rect>,
pub clip: Option<ClipShape>,
pub is_window_root_clip: bool,
pub artifact: Option<LayoutArtifact>,
}Expand description
Layout output for one element: geometry, child placement, clipping, and an artifact.
Rectangles use element-local logical pixels unless a field states otherwise.
children is positional: entry n describes retained child n. An empty
vector means that no direct child was laid out. No constructor validates
finite or non-negative geometry.
§Examples
use ailloli_ui_core::{Rect, Size};
use ailloli_ui_runtime::layout::LayoutResult;
let mut result = LayoutResult::empty();
result.size = Size::new(80.0, 24.0);
result.paint_bounds = Rect::new(0.0, 0.0, 80.0, 24.0);
assert_eq!(result.children.len(), 0);Fields§
§size: SizeElement size in logical pixels.
children: Vec<ChildLayout>Direct-child geometry, in the same order as the retained children.
paint_bounds: RectElement-local region that may receive draw commands.
visual_bounds: RectElement-local region containing paint plus visual effects such as shadows.
overlay_hit_bounds: Vec<Rect>Extra local hit-test regions for top-level overlays owned by this widget.
These rects do not affect layout, paint bounds, visual bounds, or parent clipping. The input router translates them to absolute coordinates and checks them before normal tree hit-testing.
clip: Option<ClipShape>Optional element-local clip; None means this result introduces no clip.
is_window_root_clip: boolWindow root clip (Window::radius + clip_children on the surface wrapper).
artifact: Option<LayoutArtifact>Optional reusable layout data; None means paint must not expect an artifact.
Implementations§
Source§impl LayoutResult
Provides the operations defined for LayoutResult.
impl LayoutResult
Provides the operations defined for LayoutResult.
Sourcepub fn empty() -> Self
pub fn empty() -> Self
Returns a zero-sized result with no children, clips, overlays, or artifact.
Both bounds are (0, 0, 0, 0) and is_window_root_clip is false.
§Examples
use ailloli_ui_core::Size;
use ailloli_ui_runtime::layout::LayoutResult;
let result = LayoutResult::empty();
assert_eq!(result.size, Size::default());
assert!(result.children.is_empty() && result.artifact.is_none());Sourcepub fn zero() -> Self
pub fn zero() -> Self
Alias for Self::empty.
§Examples
use ailloli_ui_runtime::layout::LayoutResult;
let result = LayoutResult::zero();
assert_eq!(result.paint_bounds.w, 0.0);Trait Implementations§
Source§impl Clone for LayoutResult
impl Clone for LayoutResult
Source§fn clone(&self) -> LayoutResult
fn clone(&self) -> LayoutResult
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for LayoutResult
impl !RefUnwindSafe for LayoutResult
impl Send for LayoutResult
impl Sync for LayoutResult
impl Unpin for LayoutResult
impl !UnwindSafe for LayoutResult
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<A> IntoClickAction<A> for Awhere
A: Clone + 'static,
impl<A> IntoClickAction<A> for Awhere
A: Clone + 'static,
Source§fn into_click_action(self) -> ClickAction<A>
fn into_click_action(self) -> ClickAction<A>
Implements the into_click_action helper used by this module.