Align review titles consistently at the top of each row
This commit is contained in:
parent
bb13e2b6fa
commit
307cbfad99
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Reference in New Issue