layout
Layout units, axes, and common properties shared by renderable nodes.
Structs
CommonProperties
Properties shared by every renderable Pax node.
Each property here is special-cased by the compiler when parsing element properties,
for example <SomeElement width={...} />.
Properties
id
Type: Property<Option<String>>
Optional stable node identifier.
x
Horizontal position.
y
Vertical position.
padding_x
Symmetric inner spacing applied to this node's child layout area on the x axis.
padding_y
Symmetric inner spacing applied to this node's child layout area on the y axis.
width
Horizontal extent.
height
Vertical extent.
anchor_x
Horizontal transform origin, relative to the node's own bounds.
anchor_y
Vertical transform origin, relative to the node's own bounds.
scale_x
Horizontal scale coefficient.
scale_y
Vertical scale coefficient.
skew_x
Type: Property<Option<Rotation>>
Horizontal skew.
skew_y
Type: Property<Option<Rotation>>
Vertical skew.
rotate
Type: Property<Option<Rotation>>
Rotation around the z axis.
transform
Type: Property<Option<Transform2D>>
Full composed transform.
opacity
Type: Property<Option<Opacity>>
Node opacity, applied to the node and its descendants.
layout_role
Type: Property<Option<LayoutRole>>
Controls whether this node participates in parent layout measurement and flow.
unclippable
Type: Property<Option<bool>>
Allows a node to render outside an ancestor clipping frame.
Enums
Axis
Model of 2D cartesian axes, used to disambiguate calculations that depend on axis direction (e.g. width vs height)
Variants
X
Horizontal axis.
Y
Vertical axis.
LayoutRole
Controls whether a node participates in parent layout measurement.
Variants
Default
Normal layout behavior. The node contributes to parent hulls, autosize, and flow.
Breakout
Parent-local positioning that does not contribute to parent hulls, autosize, or flow.
Breakout remains in the normal render, hit-test, scroll, and clipping trees; it does
not portal above ancestor frames, masks, or scrollers.
Size
A spatial size value that can be either a concrete pixel value like 25px, a percent of parent bounds like 50%,
or an additive/subtractive combination of the two like (100% - 10px).
Variants
Pixels(Numeric)
Concrete pixel length, such as 25px.
Percent(Numeric)
Percent length relative to the relevant parent bound, such as 50%.
Combined(Numeric, Numeric)
Additive pixel and percent components, such as 100% - 10px.
Implementations
ZERO
pub fn ZERO() -> Self
Returns a zero-pixel size.
expect_percent
pub fn expect_percent(&self) -> f64
Returns the wrapped percent value normalized as a float, such that 100% => 1.0. Panics if wrapped type is not a percentage.
expect_pixels
pub fn expect_pixels(&self) -> Numeric
Returns the pixel value Panics if wrapped type is not pixels.
evaluate
pub fn evaluate(&self, bounds: (f64, f64), axis: Axis) -> f64
Evaluate a Size in the context of bounds and a target axis.
Returns a Pixel value as a simple f64; calculates Percent with respect to bounds & axis
get_pixels
pub fn get_pixels(&self, parent: f64) -> f64
Resolves this size against a parent extent in pixels.