pub struct LayoutState { /* private fields */ }Expand description
Retained layout state for a LayoutNode. This mirrors Jetpack Compose’s approach where each node stores its own measured size and placed position, eliminating the need for per-frame LayoutTree reconstruction.
Implementations§
Source§impl LayoutState
impl LayoutState
pub fn size(&self) -> Size
pub fn position(&self) -> Point
Sourcepub fn content_offset(&self) -> Point
pub fn content_offset(&self) -> Point
Offset of the content box relative to the node origin (e.g. due to padding).
Sourcepub fn set_content_offset(&mut self, offset: Point)
pub fn set_content_offset(&mut self, offset: Point)
Writes the content offset, reporting an actual change to the semantics tree.
Sourcepub fn at_origin(self) -> Self
pub fn at_origin(self) -> Self
The same state placed at the origin: what a window root’s own scene starts from, since the position its parent gave it belongs to the parent’s window.
pub fn is_placed(&self) -> bool
Sourcepub fn set_size(&mut self, size: Size)
pub fn set_size(&mut self, size: Size)
Writes the measured size, self-reporting an actual change to the scene phase.
Sourcepub fn place(&mut self, position: Point)
pub fn place(&mut self, position: Point)
Writes the placed position and marks the node placed, self-reporting an actual move to the scene phase, and a placement of a node the scene does not draw: one the running pass did not find placed.
Sourcepub fn clear_placed(&mut self)
pub fn clear_placed(&mut self)
Clears the placed flag at the start of a layout pass. Until its parent places it again the pass counts the node unplaced, and the pass names it to the scene phase if it ends that way.