1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-31 13:50:04 -04:00

Improve size negotiation code.

Better enfocred minimum sizes.
You can now have windows that expand to fit their content.
This commit is contained in:
Emil Ernerfeldt
2020-05-01 02:08:01 +02:00
parent 7cd8ac2bbf
commit b73fbb33d8
11 changed files with 332 additions and 159 deletions

View File

@@ -165,8 +165,12 @@ impl ScrollArea {
});
}
let size = content_size.min(inner_rect.size());
outer_region.reserve_space_without_padding(size);
// let size = content_size.min(inner_rect.size());
let size = vec2(
content_size.x, // ignore inner_rect, i.e. try to expand horizontally if necessary
content_size.y.min(inner_rect.size().y), // respect vertical height.
);
outer_region.reserve_space(size, None);
state.offset.y = state.offset.y.min(content_size.y - inner_rect.height());
state.offset.y = state.offset.y.max(0.0);