Skip to content

Commit

Permalink
Bug fix: click anywhere on a Table row to select it (#5193)
Browse files Browse the repository at this point in the history
* Closes #5184
  • Loading branch information
emilk authored Sep 30, 2024
1 parent db3dcaf commit 5390ecd
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions crates/egui_extras/src/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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)
}
Expand Down Expand Up @@ -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();
}
Expand Down

0 comments on commit 5390ecd

Please sign in to comment.