layout

Structs

LayoutHull

Per-axis local extents contributed by a node subtree for container measurement.

Coordinates are expressed in the node's local layout space. Validity is tracked per axis so parent-dependent axes can be ignored without discarding the entire subtree.

Properties

min_x

Type: f64

max_x

Type: f64

min_y

Type: f64

max_y

Type: f64

valid_x

Type: bool

valid_y

Type: bool


LayoutProperties

Unresolved layout inputs copied out of common properties before geometry calculation.

Properties

x

Type: Option<Size>

y

Type: Option<Size>

width

Type: Option<Size>

height

Type: Option<Size>

rotate

Type: Option<Rotation>

scale_x

Type: Option<Percent>

scale_y

Type: Option<Percent>

anchor_x

Type: Option<Size>

anchor_y

Type: Option<Size>

skew_x

Type: Option<Rotation>

skew_y

Type: Option<Rotation>

Implementations

fill
pub fn fill() -> Self

Full-size defaults for nodes that should fill their containing bounds.


TransformAndBounds

Pax's canonical representation of position, size, and transform, encoded as a transform (translation, rotation, scale, skew) and a separate width/height (bounds) value. Bounds are expressed as the (x1, y1) values of the axis-aligned pre-transform bounding box, where (x0, y0) are the origin.

In this model, position is a derived property, calculated by applying the transform to the bounding box.

Properties

transform

Type: Transform2<F, T>

bounds

Type: (f64, f64)

Implementations

as_pure_scale
pub fn as_pure_scale(self) -> Self

Move bounds into the transform as scale, leaving unit bounds.

as_pure_size
pub fn as_pure_size(self) -> Self

Move scale from the transform into the bounds field.

as_transform
pub fn as_transform(&self) -> Transform2<F, T>

Convert this split representation into a single affine transform.

cast_spaces
pub fn cast_spaces<A: Space, B: Space>(self) -> TransformAndBounds<A, B>

Retype coordinate-space markers without changing numeric values.

center
pub fn center(&self) -> Point2<T>

Center point of this transformed box.

contains_point
pub fn contains_point(&self, point: Point2<T>) -> bool

Test whether a point falls inside this transformed box.

corners
pub fn corners(&self) -> [Point2<T>; 4]

Corners of this transformed box, starting at origin and proceeding around the rectangle.

intersects
pub fn intersects(&self, other: &Self) -> bool

Test transformed-box intersection using the separating axis theorem.

inverse
pub fn inverse(&self) -> TransformAndBounds<T, F>

Invert the transform-and-bounds mapping.

Functions

add_symmetric_padding_to_content_layout_hull

pub fn add_symmetric_padding_to_content_layout_hull(hull: LayoutHull, padding_x: Option<Size>, padding_y: Option<Size>) -> LayoutHull

Expand a content-space hull into the node's padded outer layout space.

Children are laid out inside the leading padding offset, but autosized bounds must be solved from the content hull itself. Solving the outer size first keeps percentage padding from feeding back through the node's current measured bounds.


apply_container_frame

pub fn apply_container_frame(container_transform_and_bounds: TransformAndBounds<NodeLocal, Window>, container_frame: Option<ContainerFrame>) -> TransformAndBounds<NodeLocal, Window>

Apply a container-assigned child frame on top of the parent geometry.

This is the geometry seam where container-owned placement can cooperate with descendant-authored layout and future bottom-up measurement.


apply_padding_frame

pub fn apply_padding_frame(container_transform_and_bounds: TransformAndBounds<NodeLocal, Window>, padding_x: Option<Size>, padding_y: Option<Size>) -> TransformAndBounds<NodeLocal, Window>

Apply a node's padding to the container geometry seen by its children.


calculate_transform_and_bounds

pub fn calculate_transform_and_bounds(_: &LayoutProperties, _: TransformAndBounds<NodeLocal, Window>) -> TransformAndBounds<NodeLocal, Window>

Resolve one set of layout properties into concrete bounds and a window-space transform.


compute_tab

pub fn compute_tab(layout_properties: Property<LayoutProperties>, extra_transform: Property<Option<Transform2D>>, container_transform_and_bounds: Property<TransformAndBounds<NodeLocal, Window>>) -> Property<TransformAndBounds<NodeLocal, Window>>

Compute a reactive TransformAndBounds property from layout properties plus parent geometry.


project_child_layout_hull_to_parent_space

pub fn project_child_layout_hull_to_parent_space(parent: TransformAndBounds<NodeLocal, Window>, child: TransformAndBounds<NodeLocal, Window>, child_hull: LayoutHull) -> LayoutHull

Project a child's local hull into its parent's local layout space.


project_layout_hull

pub fn project_layout_hull<F: Space, T: Space>(transform: Transform2<F, T>, hull: LayoutHull) -> LayoutHull

Project a local layout hull through the provided transform and return the axis-aligned hull in the destination coordinate space.


resolve_padded_autosize_axis

pub fn resolve_padded_autosize_axis(content_extent: f64, padding: Option<Size>) -> Option<f64>

Solve an autosized outer axis from measured content and symmetric padding.