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 <noreply@anthropic.com>
This commit is contained in:
Dylan M. Taylor
2026-11-29 22:30:15 +00:00
co-authored by Claude Opus 5.5
parent f50ee30a7b
commit 64c1a82d2e
2 changed files with 14 additions and 2 deletions
+11
View File
@@ -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();
+3 -2
View File
@@ -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());