From f5ff92c75101e1d7667c7ae2b359baf2127671f0 Mon Sep 17 00:00:00 2001 From: zanciks Date: Tue, 1 Apr 2025 11:01:13 -0600 Subject: [PATCH 1/2] Added check for Num Rows in egui::Grid::paint_row() --- crates/egui/src/grid.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/egui/src/grid.rs b/crates/egui/src/grid.rs index 9ad386cc67d..be369961744 100644 --- a/crates/egui/src/grid.rs +++ b/crates/egui/src/grid.rs @@ -251,7 +251,11 @@ impl GridLayout { let size = Vec2::new(self.prev_state.full_width(self.spacing.x), height); let rect = Rect::from_min_size(cursor.min, size); let rect = rect.expand2(0.5 * self.spacing.y * Vec2::Y); - let rect = rect.expand2(2.0 * Vec2::X); // HACK: just looks better with some spacing on the sides + let mut rect = rect.expand2(2.0 * Vec2::X); // HACK: just looks better with some spacing on the sides + + if self.num_columns.is_some() { + rect.set_width(cursor.width()) + } painter.rect_filled(rect, 2.0, row_color); } From ee17767c0a67360ea8a50c17eb0bafcaa0cd8eb1 Mon Sep 17 00:00:00 2001 From: zanciks Date: Tue, 1 Apr 2025 11:05:38 -0600 Subject: [PATCH 2/2] added semicolon for formatting --- crates/egui/src/grid.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/egui/src/grid.rs b/crates/egui/src/grid.rs index be369961744..01739278ea2 100644 --- a/crates/egui/src/grid.rs +++ b/crates/egui/src/grid.rs @@ -254,7 +254,7 @@ impl GridLayout { let mut rect = rect.expand2(2.0 * Vec2::X); // HACK: just looks better with some spacing on the sides if self.num_columns.is_some() { - rect.set_width(cursor.width()) + rect.set_width(cursor.width()); } painter.rect_filled(rect, 2.0, row_color);