diff options
author | Emil Ernerfeldt <emil.ernerfeldt@gmail.com> | 2024-09-30 13:20:03 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-30 13:20:03 +0200 |
commit | 5390ecdf4abd54503e067f01d3f5c93614afe305 (patch) | |
tree | 9f63c3021e1226b0928525561cee283da9b6c6bf | |
parent | db3dcaf447819d38d3bc6a3c3f9d074759efd9b2 (diff) |
Bug fix: click anywhere on a `Table` row to select it (#5193)
* Closes https://github.com/emilk/egui/issues/5184
-rw-r--r-- | crates/egui_extras/src/layout.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/crates/egui_extras/src/layout.rs b/crates/egui_extras/src/layout.rs index ec4938f0..239e7b1d 100644 --- a/crates/egui_extras/src/layout.rs +++ b/crates/egui_extras/src/layout.rs @@ -149,10 +149,13 @@ impl<'l> StripLayout<'l> { ); } - let child_ui = self.cell(flags, max_rect, child_ui_id_salt, add_cell_contents); + let mut child_ui = self.cell(flags, max_rect, child_ui_id_salt, add_cell_contents); let used_rect = child_ui.min_rect(); + // Make sure we catch clicks etc on the _whole_ cell: + child_ui.set_min_size(max_rect.size()); + let allocation_rect = if self.ui.is_sizing_pass() { used_rect } else if flags.clip { @@ -165,7 +168,7 @@ impl<'l> StripLayout<'l> { self.ui.advance_cursor_after_rect(allocation_rect); - let response = child_ui.interact(max_rect, child_ui.id(), self.sense); + let response = child_ui.response(); (used_rect, response) } @@ -204,7 +207,8 @@ impl<'l> StripLayout<'l> { .id_salt(child_ui_id_salt) .ui_stack_info(egui::UiStackInfo::new(egui::UiKind::TableCell)) .max_rect(max_rect) - .layout(self.cell_layout); + .layout(self.cell_layout) + .sense(self.sense); if flags.sizing_pass { ui_builder = ui_builder.sizing_pass(); } |