EffectCraft: An open-source motion graphics and compositing tool written by scratch in pure Rust
#1284: right-clicking a Graph Editor keyframe opens its key menu
Claudea7cad22c13a0
diff --git a/crates/ui-egui/src/panels/graph.rs b/crates/ui-egui/src/panels/graph.rsindex 2dbb98268..41e2c5263 100644--- a/crates/ui-egui/src/panels/graph.rs+++ b/crates/ui-egui/src/panels/graph.rs@@ -453,7 +453,7 @@ pub(crate) fn show(app: &mut EffectcraftApp, ui: &mut egui::Ui, p: &egui::Painte}} else if kresp.clicked() && mods.shift {actions.push(("keys.select".into(), json!({"keys": [kjson.clone()], "toggle": true})));- } else if (kresp.clicked() || kresp.drag_started()) && !k.sel {+ } else if (kresp.clicked() || kresp.drag_started() || kresp.secondary_clicked()) && !k.sel {actions.push(("keys.select".into(), json!({"keys": [kjson.clone()], "add": mods.shift})));}// A drag moves every selected key, by how far the pointer went from where the button@@ -485,6 +485,48 @@ pub(crate) fn show(app: &mut EffectcraftApp, ui: &mut egui::Ui, p: &egui::Paintectx.data_mut(|dd| dd.insert_temp(drag_id, false));actions.push(("__endMerge".into(), json!({})));}+ // Right-click: the Timeline's key menu, for the commands that apply from the Graph Editor.+ kresp.context_menu(|ui| {+ let editable_value = matches!(key.value, Value::Scalar(_) | Value::Vec2(_) | Value::Vec3(_));+ for (lbl, cmd, params) in [+ ("Edit Value…", "keys.set", kjson.clone()),+ ("-", "", json!({})),+ ("Copy", "keys.copy", json!({})),+ ("Paste", "keys.paste", json!({})),+ ("-", "", json!({})),+ ("Select Equal Keyframes", "keys.selectEqual", json!({})),+ ("Select Previous Keyframes", "keys.selectPrevious", json!({})),+ ("Select Following Keyframes", "keys.selectFollowing", json!({})),+ ("-", "", json!({})),+ ("Toggle Hold Keyframe", "keys.toggleHold", json!({})),+ ("Rove Across Time", "keys.interpolation", json!({"roving": !key.roving})),+ ("-", "", json!({})),+ ("Easy Ease", "keys.easyEase", json!({})),+ ("Easy Ease In", "keys.easyEaseIn", json!({})),+ ("Easy Ease Out", "keys.easyEaseOut", json!({})),+ ("-", "", json!({})),+ ("Linear", "keys.interpolation", json!({"interpolation": "linear"})),+ ("Bezier", "keys.interpolation", json!({"interpolation": "bezier"})),+ ("Auto Bezier", "keys.interpolation", json!({"interpolation": "autoBezier"})),+ ("-", "", json!({})),+ ("Delete", "keys.delete", json!({})),+ ] {+ if lbl == "-" {+ ui.separator();+ continue;+ }+ if lbl == "Rove Across Time" && !c.prop.spatial {+ continue;+ }+ if lbl == "Edit Value…" && !editable_value {+ continue;+ }+ if ui.button(lbl).clicked() {+ actions.push((cmd.into(), params));+ ui.close();+ }+ }+ });}}