Shapes: Duplicate duplicates the selected shape items, not the layer (#227)

Edit > Duplicate (Ctrl+D) with a shape group or other shape item
selected in the Timeline duplicated the whole shape layer. As in After
Effects it now duplicates the selected items inside their group, each
copy above its original and numbered on ("Rectangle 1" gives
"Rectangle 2"), and selects the copies. With only layers selected the
layers are duplicated as before.

Test: duplicate_with_shape_items_selected_duplicates_them_in_place,
ctrl_d_duplicates_the_selected_shape_group_in_its_layer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
bflatastic
2026-10-08 13:03:38 +07:00
co-authored by Claude Opus 5.5
parent 95bb346c89
commit 0048569682
4 changed files with 75 additions and 1 deletions
@@ -171,6 +171,16 @@ fn ctrl_c_and_ctrl_v_copy_a_shape_group_into_another_shape_layer() {
assert_eq!(contents_names(&h, a), ["Rectangle 1"]);
}
#[test]
fn ctrl_d_duplicates_the_selected_shape_group_in_its_layer() {
let (mut h, a, _, rect) = two_shape_layers();
click(&mut h, &format!("timeline.group.{rect}.name"));
h.input_mut().events.push(Event::Key { key: Key::D, physical_key: None, pressed: true, repeat: false, modifiers: Modifiers::COMMAND });
h.run_steps(3);
assert_eq!(h.state().session.active_comp().unwrap().layers.len(), 2, "no new layer");
assert_eq!(contents_names(&h, a), ["Rectangle 2", "Rectangle 1"]);
}
#[test]
fn toolbar_stroke_edits_the_selected_shape_layer() {
let mut s = session();