1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-02 06:40:06 -04:00

egui_extras: Improve the auto-sizing of Table (#4756)

This makes the sizing pass of an `egui_table` ensure the table uses as
little width as possible.
Subsequently, it will redistribute all non-resizable columns on the
available space, so that a table better follow the parent container as
it is resized.

I also added `table.reset()` for forgetting the current column widths.
This commit is contained in:
Emil Ernerfeldt
2024-07-02 21:13:55 +02:00
committed by GitHub
parent 753412193c
commit 8ef0e85b85
4 changed files with 119 additions and 41 deletions

View File

@@ -150,14 +150,16 @@ impl<'l> StripLayout<'l> {
let used_rect = child_ui.min_rect();
self.set_pos(max_rect);
let allocation_rect = if flags.clip {
let allocation_rect = if self.ui.is_sizing_pass() {
used_rect
} else if flags.clip {
max_rect
} else {
max_rect.union(used_rect)
};
self.set_pos(allocation_rect);
self.ui.advance_cursor_after_rect(allocation_rect);
let response = child_ui.interact(max_rect, child_ui.id(), self.sense);