Packer¶
GTK2-style box packing algorithm. Computes child allocations given container dimensions, packing axis, and children's size hints + pack options.
When expanding children have more space than needed, extra is distributed equally. When there is less space than needed, expanding children shrink proportionally. Non-expanding children always get their preferred size (truncated only if they physically exceed remaining space).
Constructors¶
create¶
Returns¶
- Packer val^
Public Functions¶
pack¶
Compute child allocations within a container. Handles pack_start/pack_end, expand/fill, padding, proportional shrinking, and container alignment.
fun box pack(
axis: (Horizontal val | Vertical val),
container_w: USize val,
container_h: USize val,
children: Array[(USize val , USize val , PackOption val , Bool val)] val,
align: (AlignStart val | AlignCenter val | AlignEnd val) = reference)
: Array[Allocation val] val
Parameters¶
- axis: (Horizontal val | Vertical val)
- container_w: USize val
- container_h: USize val
- children: Array[(USize val , USize val , PackOption val , Bool val)] val
- align: (AlignStart val | AlignCenter val | AlignEnd val) = reference
Returns¶
- Array[Allocation val] val
eq¶
Parameters¶
- that: Packer val
Returns¶
- Bool val
ne¶
Parameters¶
- that: Packer val
Returns¶
- Bool val