pub fn percent<T>(value: T) -> Valwhere
T: ValNum,Expand description
Returns a Val::Percent representing a percentage of the parent node’s length
along a specific axis.
If the UI node has no parent, the percentage is based on the window’s length along that axis.
Axis rules:
- For
flex_basis, the percentage is relative to the main-axis length determined by theflex_direction. - For
gap,min_size,size, andmax_size:widthis relative to the parent’s width.heightis relative to the parent’s height.
- For
margin,padding, andbordervalues: the percentage is relative to the parent’s width. - For positions,
leftandrightare relative to the parent’s width, whilebottomandtopare relative to the parent’s height.