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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user