Make gap distribution counts prominent in schedule rows

This commit is contained in:
Dandaedre 2026-11-05 12:13:05 +01:00
parent 88e943415f
commit 639886b864
2 changed files with 32 additions and 3 deletions

View File

@ -2305,7 +2305,9 @@ impl App {
.map(|text| text_width(&text))
.fold(105.0, f32::max)
.ceil();
let controls_width = (text_width("Auto (Marker)") + 30.0).max(115.0);
let controls_width = (text_width("Auto (Marker)") + 30.0)
.max(text_width("Across 100 events") + 8.0)
.max(115.0);
let timing_width = if compact {
compact_timing_width
} else {
@ -2463,9 +2465,14 @@ impl App {
} else {
0.0
};
let distribution = row.gap_key.as_ref().and_then(|key| profile.gap_options.get(key)).filter(|options| options.distribute);
let distribution_height = if distribution.is_some() {
ui.text_style_height(&egui::TextStyle::Body) + ui.spacing().item_spacing.y
} else { 0.0 };
let row_height = (title_height + issue_height)
.max(timing_height)
.max(ui.spacing().interact_size.y + pending_height);
.max(ui.spacing().interact_size.y + pending_height)
.max(ui.spacing().interact_size.y + distribution_height);
let response = ui.vertical(|ui| {
ui.set_width(row_width);
ui.set_min_height(row_height);
@ -2612,7 +2619,10 @@ impl App {
if let Some(key) = &row.gap_key {
ui.push_id(("gap_row", row_index), |ui| Self::gap_resolution_control(ui, &mut profile, key));
if profile.gap_options.get(key).is_some_and(|options| options.distribute) {
ui.small(format!("Across {} events", profile.gap_options[key].count));
let count = profile.gap_options[key].count;
ui.label(RichText::new(format!("Across {count} {}", if count == 1 { "event" } else { "events" }))
.color(if pending { PREVIEW_PENDING } else { PREVIEW_GAP }).strong())
.on_hover_text("This gap is distributed across neighbouring events. Double-click the row to change the count or direction.");
}
} else {
ui.push_id(("schedule_kind", row_index, row.row), |ui| {
@ -2832,6 +2842,23 @@ mod tests {
);
assert!(labels.iter().any(|(label, _)| label == "Number of events"));
assert!(!app.dirty);
app.row_details = false;
for size in [[1000.0, 900.0], [560.0, 700.0]] {
render(&mut app, &ctx, size, vec![]);
let labels = render(&mut app, &ctx, size, vec![]);
assert_eq!(
labels
.iter()
.filter(|(label, _)| label == "Across 2 events")
.count(),
2
);
assert!(
!labels
.iter()
.any(|(label, _)| label == "Distribute across neighbours")
);
}
}
}

View File

@ -93,6 +93,8 @@ visually distinct from labels and ordinary actions; the active tab uses the stro
its title defaults to the named break, or “Break”, and can be edited in the gap editor.
Double-click the row or use **Edit gap…** for the additional options.
Distributed gaps show **Across N events** beneath the resolution dropdown in each
schedule row; the label uses the pending colour until Apply & recheck.
**Distribute across neighbours** divides the gap equally across N contiguous events:
- Extend previous / Add to next lengthens each of the previous / following N timers.
- Keep gap inserts N untimed intervals, after previous events or before following events.