1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-30 21:30:03 -04:00

Better handling of full-width widgets inside of Ui:s with inf max size

This commit is contained in:
Emil Ernerfeldt
2020-05-10 18:59:18 +02:00
parent be6ada6923
commit 274acff47e
3 changed files with 46 additions and 4 deletions

View File

@@ -54,14 +54,14 @@ impl CollapsingHeader {
default_open,
} = self;
// TODO: horizontal layout, with icon and text as labels. Inser background behind using Frame.
// TODO: horizontal layout, with icon and text as labels. Insert background behind using Frame.
let title = &label.text; // TODO: not this
let id = ui.make_unique_id(title);
let text_pos = ui.cursor() + vec2(ui.style().indent, 0.0);
let (title, text_size) = label.layout(text_pos, ui);
let text_max_x = text_pos.x + text_size.x;
let desired_width = ui.available_width().max(text_max_x - ui.cursor().x);
let desired_width = ui.available_space_min().x.max(text_max_x - ui.cursor().x);
let interact = ui.reserve_space(
vec2(