From 64c1a82d2e088cd5c4aa03b5d2787d5c4a802046 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Sun, 29 Nov 2026 22:30:15 +0000 Subject: [PATCH] Animation pane: the timeline keeps its share of the row The name column took its content width and the timeline the rest, so the longest name squeezed the axis until its labels ran together, and a long name pushed the timeline out of the pane. Name and timeline now share the row by weight: the name elides and the axis stays readable. Co-Authored-By: Claude Opus 5.5 --- crates/ui-egui/src/animpane_tests.rs | 11 +++++++++++ crates/ui-egui/src/panels/animation.rs | 5 +++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/crates/ui-egui/src/animpane_tests.rs b/crates/ui-egui/src/animpane_tests.rs index 856b1627b..0c2855577 100644 --- a/crates/ui-egui/src/animpane_tests.rs +++ b/crates/ui-egui/src/animpane_tests.rs @@ -58,6 +58,17 @@ fn after_previous_bar_starts_where_the_first_ends() { assert!((b.width() - 2.0 * a.width()).abs() < 1.5, "2 s bar twice the 1 s bar"); } +#[test] +fn a_long_name_keeps_the_timeline_column() { + let mut h = harness(); + let before = h.get_by_role_and_label(egui::accesskit::Role::Slider, "Timing bar 1").rect(); + let id = h.state().session.active().unwrap().current_slide().unwrap().animations[0].shape.0; + h.state_mut().run("shape.rename", json!({"id": id, "name": "Aurora borealis over the northern lakes at midnight in winter"})).unwrap(); + h.run_steps(3); + let after = h.query_by_role_and_label(egui::accesskit::Role::Slider, "Timing bar 1").map(|node| node.rect()); + assert!(after.is_some_and(|after| after.width() >= before.width() - 0.5), "{before:?} {after:?}"); +} + #[test] fn dragging_a_bar_sets_the_delay_and_undoes() { let mut h = harness(); diff --git a/crates/ui-egui/src/panels/animation.rs b/crates/ui-egui/src/panels/animation.rs index e6396e085..d0e8fea8f 100644 --- a/crates/ui-egui/src/panels/animation.rs +++ b/crates/ui-egui/src/panels/animation.rs @@ -113,10 +113,11 @@ pub(super) fn animation(app: &mut SlideApp, ui: &mut Ui) { let seconds = animtimeline::ruler_seconds(&bars); let range = 0.0..=f64::from(seconds); let every = (seconds / 6).max(1); + // The name and the timeline share the row, so a long name elides and the timeline keeps its column. let columns = vec![ craft::ui::contract::ColumnSpec::new(CLICK, Label::Empty, ColumnWidth::Content), - craft::ui::contract::ColumnSpec::new(NAME, Label::Empty, ColumnWidth::Content), - craft::ui::contract::ColumnSpec::new(TIMING, Label::Empty, ColumnWidth::fill(1.0)).at_least(Env::of(ui).tokens.size.length.track), + craft::ui::contract::ColumnSpec::new(NAME, Label::Empty, ColumnWidth::fill(2.0)), + craft::ui::contract::ColumnSpec::new(TIMING, Label::Empty, ColumnWidth::fill(3.0)).at_least(Env::of(ui).tokens.size.length.track), craft::ui::contract::ColumnSpec::new(REPEAT, Label::Empty, ColumnWidth::Controls(1.0)), ]; let commits = RefCell::new(Vec::new());