pub(crate) struct Region {
pub min_rect: Rect,
pub max_rect: Rect,
pub(crate) cursor: Rect,
}
Expand description
Fields§
§min_rect: Rect
This is the minimal size of the Ui
.
When adding new widgets, this will generally expand.
Always finite.
The bounding box of all child widgets, but not necessarily a tight bounding box
since Ui
can start with a non-zero min_rect
size.
max_rect: Rect
The maximum size of this Ui
. This is a soft max
meaning new widgets will try not to expand beyond it,
but if they have to, they will.
Text will wrap at max_rect.right()
.
Some widgets (like separator lines) will try to fill the full max_rect
width of the ui.
max_rect
will always be at least the size of min_rect
.
If the max_rect
size is zero, it is a signal that child widgets should be as small as possible.
If the max_rect
size is infinite, it is a signal that child widgets should take up as much room as they want.
cursor: Rect
Where the next widget will be put.
One side of this will always be infinite: the direction in which new widgets will be added.
The opposing side is what is incremented.
The crossing sides are initialized to max_rect
.
So one can think of cursor
as a constraint on the available region.
If something has already been added, this will point to style.spacing.item_spacing
beyond the latest child.
The cursor can thus be style.spacing.item_spacing
pixels outside of the min_rect
.
Implementations§
Source§impl Region
impl Region
Sourcepub fn expand_to_include_rect(&mut self, rect: Rect)
pub fn expand_to_include_rect(&mut self, rect: Rect)
Expand the min_rect
and max_rect
of this ui to include a child at the given rect.
Sourcepub fn expand_to_include_x(&mut self, x: f32)
pub fn expand_to_include_x(&mut self, x: f32)
Ensure we are big enough to contain the given X-coordinate. This is sometimes useful to expand a ui to stretch to a certain place.
Sourcepub fn expand_to_include_y(&mut self, y: f32)
pub fn expand_to_include_y(&mut self, y: f32)
Ensure we are big enough to contain the given Y-coordinate. This is sometimes useful to expand a ui to stretch to a certain place.