[ui] bug fix: default size of horizontal/vertical regions
This commit is contained in:
parent
48e42ff6a5
commit
98bced7e62
1 changed files with 6 additions and 1 deletions
|
@ -609,7 +609,12 @@ impl Ui {
|
||||||
layout: Layout,
|
layout: Layout,
|
||||||
add_contents: impl FnOnce(&mut Self) -> R,
|
add_contents: impl FnOnce(&mut Self) -> R,
|
||||||
) -> (R, Rect) {
|
) -> (R, Rect) {
|
||||||
let child_rect = Rect::from_min_max(self.cursor, self.bottom_right());
|
let initial_size = if layout.dir() == Direction::Horizontal {
|
||||||
|
vec2(self.available().width(), 0.0)
|
||||||
|
} else {
|
||||||
|
vec2(0.0, self.available().height())
|
||||||
|
};
|
||||||
|
let child_rect = Rect::from_min_size(self.cursor, initial_size);
|
||||||
let mut child_ui = self.child_ui(child_rect);
|
let mut child_ui = self.child_ui(child_rect);
|
||||||
child_ui.set_layout(layout); // HACK: need a separate call right now
|
child_ui.set_layout(layout); // HACK: need a separate call right now
|
||||||
let ret = add_contents(&mut child_ui);
|
let ret = add_contents(&mut child_ui);
|
||||||
|
|
Loading…
Reference in a new issue