Timeline: Shift-clicking layer bars selects the range (#284)

Shift-clicking a layer's name selected the layers from the last one
clicked to it, but Shift-clicking a layer bar in the time graph only
added that layer. Bars now select the same range (shared with the
name column: `shift_range`), and a click on a bar becomes where the next
range starts, as a click on a name does.

Test: timeline_shift_click_on_layer_bars_selects_the_range
(ui_workflow_selection).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
bflatastic
2026-10-09 16:59:53 +07:00
co-authored by Claude Opus 5.5
parent f9570d783a
commit 976784b0a6
2 changed files with 57 additions and 22 deletions
@@ -58,6 +58,26 @@ fn timeline_shift_click_selects_range_and_ctrl_toggles() {
click(&mut h, p, Modifiers::COMMAND);
assert_eq!(h.state().session.state.selected_layers, vec![ids[0], ids[2]]);
}
/// #284: Shift-clicking layer bars in the time graph selects the range from the last layer
/// clicked, as Shift-clicking their names does.
#[test]
fn timeline_shift_click_on_layer_bars_selects_the_range() {
let mut h = harness();
let ids: Vec<LayerId> = h.state().session.active_comp().unwrap().layers.iter().map(|l| l.id).collect();
let bar = |h: &Harness<'_, EffectcraftApp>, id: LayerId| rect(h, &format!("timeline.layer.{}.bar", id.0)).center();
let p = bar(&h, ids[3]);
click(&mut h, p, Modifiers::NONE);
assert_eq!(h.state().session.state.selected_layers, vec![ids[3]]);
let p = bar(&h, ids[1]);
click(&mut h, p, Modifiers::SHIFT);
assert_eq!(h.state().session.state.selected_layers, ids[1..]);
// From a name to a bar too.
let r = rect(&h, &format!("timeline.layer.{}.row", ids[0].0));
click(&mut h, pos2(r.min.x + 210.0, r.center().y), Modifiers::NONE);
let p = bar(&h, ids[2]);
click(&mut h, p, Modifiers::SHIFT);
assert_eq!(h.state().session.state.selected_layers, ids[..3]);
}
#[test]
fn timeline_empty_outline_marquee_selects_layers() {
let mut h = harness();