From 307cbfad99d0138c58ad154e5b385edf8b5c405e Mon Sep 17 00:00:00 2001 From: Dandaedre Date: Tue, 3 Nov 2026 14:56:25 +0100 Subject: [PATCH] Align review titles consistently at the top of each row --- crates/rundown-converter/src/gui/review.rs | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/crates/rundown-converter/src/gui/review.rs b/crates/rundown-converter/src/gui/review.rs index ae36e3e..ea5b683 100644 --- a/crates/rundown-converter/src/gui/review.rs +++ b/crates/rundown-converter/src/gui/review.rs @@ -809,8 +809,20 @@ impl App { ui.colored_label(color, value); } } + // Grid cells are centered vertically. Give the title stack enough + // height for the neighboring controls/timing so its text starts + // at the row top, whether or not it has an issue button. + let title_min_height = if compact { + 3.0 * ui.text_style_height(&egui::TextStyle::Body) + + 2.0 * ui.spacing().item_spacing.y + } else if row.gap { + ui.spacing().interact_size.y + } else { + 2.0 * ui.spacing().interact_size.y + ui.spacing().item_spacing.y + }; ui.vertical(|ui| { ui.set_width(title_width); + ui.set_min_height(title_min_height); let status = if ignored { "Ignored" } else if row.source_only { @@ -1178,6 +1190,24 @@ mod tests { assert_eq!(app.selected_row, Some(3)); } + #[test] + fn titles_align_with_or_without_issue_buttons() { + for size in [[860.0, 620.0], [560.0, 400.0]] { + let mut app = sample(); + let ctx = egui::Context::default(); + configure_style(&ctx); + render(&mut app, &ctx, size, vec![]); + let labels = render(&mut app, &ctx, size, vec![]); + let top = |text: &str| labels.iter().find(|(s, _)| s == text).unwrap().1.top(); + let timed_offset = top("Opening") - top("Auto (Event)"); + let unresolved_offset = top("Stage direction 0") - top("Auto (?)"); + assert!( + (timed_offset - unresolved_offset).abs() <= 1.0, + "Title alignment differs at {size:?}: {timed_offset} vs {unresolved_offset}" + ); + } + } + #[test] fn compact_review_keeps_corrections_visible_and_clickable() { let mut app = sample();