Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fix: click anywhere on a Table row to select it #5193

Merged
merged 1 commit into from
Sep 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading