Add function for vertical layout
This commit is contained in:
parent
da6d590908
commit
4741955f68
1 changed files with 18 additions and 3 deletions
|
@ -416,8 +416,7 @@ impl Region {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Start a region with horizontal layout
|
pub fn inner_layout<F>(&mut self, dir: Direction, align: Align, add_contents: F)
|
||||||
pub fn horizontal<F>(&mut self, align: Align, add_contents: F)
|
|
||||||
where
|
where
|
||||||
F: FnOnce(&mut Region),
|
F: FnOnce(&mut Region),
|
||||||
{
|
{
|
||||||
|
@ -425,7 +424,7 @@ impl Region {
|
||||||
data: self.data.clone(),
|
data: self.data.clone(),
|
||||||
options: self.options,
|
options: self.options,
|
||||||
id: self.id,
|
id: self.id,
|
||||||
dir: Direction::Horizontal,
|
dir,
|
||||||
align,
|
align,
|
||||||
cursor: self.cursor,
|
cursor: self.cursor,
|
||||||
bounding_size: vec2(0.0, 0.0),
|
bounding_size: vec2(0.0, 0.0),
|
||||||
|
@ -436,6 +435,22 @@ impl Region {
|
||||||
self.reserve_space_without_padding(size);
|
self.reserve_space_without_padding(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Start a region with horizontal layout
|
||||||
|
pub fn horizontal<F>(&mut self, align: Align, add_contents: F)
|
||||||
|
where
|
||||||
|
F: FnOnce(&mut Region),
|
||||||
|
{
|
||||||
|
self.inner_layout(Direction::Horizontal, align, add_contents)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Start a region with vertical layout
|
||||||
|
pub fn vertical<F>(&mut self, align: Align, add_contents: F)
|
||||||
|
where
|
||||||
|
F: FnOnce(&mut Region),
|
||||||
|
{
|
||||||
|
self.inner_layout(Direction::Vertical, align, add_contents)
|
||||||
|
}
|
||||||
|
|
||||||
/// Temporarily split split a vertical layout into several columns.
|
/// Temporarily split split a vertical layout into several columns.
|
||||||
///
|
///
|
||||||
/// region.columns(2, |columns| {
|
/// region.columns(2, |columns| {
|
||||||
|
|
Loading…
Reference in a new issue