M5.10: keyframes behave like After Effects: drags never destroy keys, stretched layers, Shift/Ctrl/Ctrl+Alt clicks, locked layers, Hold off
- A drag (keys.move steps sharing a merge key) applies its total offset to the keys as they
were before it (`Session::key_move`, `prop::shift_keys`): dragging over another key of the
property no longer deletes it; only the drop position replaces a key, as in After Effects.
- Keys of time-stretched layers move with the pointer: offsets are applied in comp time and
snapped to comp frames (drags and Alt+Arrow nudges; they moved by the layer-time distance).
- Shift+click toggles a key in or out of the selection (`keys.select {toggle}`); Ctrl+click
switches Linear ↔ Auto Bezier and Ctrl+Alt+click toggles Hold.
- Keys of locked layers can't be selected (clicks, marquee, Select All Keyframes), so nothing
edits them.
- Toggle Hold off returns an eased key to Bezier (it always restored Linear).
- Shift-dragging a key snaps to everything the current time snaps to — other keys, layer in /
out points, layer and comp markers, the work area — and a tooltip shows the key's time and how
many frames it moved.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
3b6b390f68
commit
9929b5f9ac
@@ -54,6 +54,7 @@ fn drag(h: &mut Harness<'_, EffectcraftApp>, from: Pos2, to: Pos2, modifiers: eg
|
||||
h.step();
|
||||
}
|
||||
h.input_mut().events.push(Event::PointerButton { pos: to, button: egui::PointerButton::Primary, pressed: false, modifiers });
|
||||
h.step();
|
||||
h.input_mut().events.push(Event::ModifiersChanged(Default::default()));
|
||||
h.run_steps(2);
|
||||
}
|
||||
@@ -112,3 +113,37 @@ fn ctrl_c_and_ctrl_v_copy_and_paste_keys_at_the_current_time() {
|
||||
h.run_steps(2);
|
||||
assert_eq!(key_times(&h, id), vec![0.0, 1.0, 3.0]);
|
||||
}
|
||||
|
||||
fn click_with(h: &mut Harness<'_, EffectcraftApp>, p: Pos2, modifiers: egui::Modifiers) {
|
||||
h.input_mut().events.push(Event::PointerMoved(p));
|
||||
h.step();
|
||||
h.input_mut().events.push(Event::ModifiersChanged(modifiers));
|
||||
h.input_mut().events.push(Event::PointerButton { pos: p, button: egui::PointerButton::Primary, pressed: true, modifiers });
|
||||
h.step();
|
||||
h.input_mut().events.push(Event::PointerButton { pos: p, button: egui::PointerButton::Primary, pressed: false, modifiers });
|
||||
h.step();
|
||||
h.input_mut().events.push(Event::ModifiersChanged(Default::default()));
|
||||
h.run_steps(2);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn shift_click_toggles_and_ctrl_click_switches_interpolation() {
|
||||
let (mut h, id, uid) = harness();
|
||||
let ks = keys(&h, uid);
|
||||
let shift = egui::Modifiers { shift: true, ..Default::default() };
|
||||
click_with(&mut h, ks[0], Default::default());
|
||||
click_with(&mut h, ks[1], shift);
|
||||
assert_eq!(h.state().session.state.selected_keys.len(), 2, "Shift+click adds");
|
||||
click_with(&mut h, ks[1], shift);
|
||||
assert_eq!(h.state().session.state.selected_keys.len(), 1, "and takes out again");
|
||||
let key =
|
||||
|h: &Harness<'_, EffectcraftApp>| h.state().session.active_comp().unwrap().layer(id).unwrap().props.prop("transform/opacity").unwrap().keys[0].clone();
|
||||
// Ctrl+click: Linear → Auto Bezier → Linear.
|
||||
click_with(&mut h, ks[0], egui::Modifiers::COMMAND);
|
||||
assert!(key(&h).auto_bezier, "Auto Bezier");
|
||||
click_with(&mut h, ks[0], egui::Modifiers::COMMAND);
|
||||
assert_eq!(key(&h).out_interp, effectcraft_engine::keyframe::Interp::Linear);
|
||||
// Ctrl+Alt+click: Hold.
|
||||
click_with(&mut h, ks[0], egui::Modifiers { alt: true, ..egui::Modifiers::COMMAND });
|
||||
assert_eq!(key(&h).out_interp, effectcraft_engine::keyframe::Interp::Hold);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user