Skip to content

EffectCraft: An open-source motion graphics and compositing tool written by scratch in pure Rust

Merge remote-tracking branch 'origin/main' into menu-bar-native-behaviour

Egon 500089eaac048989
diff --cc crates/ui-egui/src/panels/timeline.rs
index bee453a20,b34fbd9d3..5daea6327
--- a/crates/ui-egui/src/panels/timeline.rs
+++ b/crates/ui-egui/src/panels/timeline.rs
@@@ -3948,8 -3979,20 +3979,20 @@@ pub(crate) fn layer_menu
ui.menu_button(crate::i18n::tr("Markers"), |ui| {
item(ui, "Add Marker", "layer.addMarker", json!({"layers": layers}));
});
+ // A click toggles the switch on the target layers, as Layer ▸ Guide Layer does.
+ // (Pushed after the other items: `item` holds `actions` until its last use.)
+ let mut switch_actions: Vec<(String, serde_json::Value)> = Vec::new();
+ for (switch, label) in MENU_SWITCHES {
+ let response = ui.button(crate::i18n::tr(label));
+ auto.add(&format!("{prefix}.switch.{switch}"), response.rect, label);
+ if response.clicked() {
+ switch_actions.push(("layer.select".into(), json!({"layers": layers})));
+ switch_actions.push(("layer.setSwitch".into(), json!({"layers": layers, "switch": switch})));
+ ui.close();
+ }
+ }
ui.menu_button(crate::i18n::tr("Blending Mode"), |ui| {
- widgets::menu_scroll(ui, |ui| {
+ widgets::menu_scroll(ui, false, |ui| {
for m in BlendMode::ALL {
item(ui, m.label(), "layer.setBlendMode", json!({"layers": layers, "mode": m.label()}));
if m.ends_group() {
@@@ -4009,11 -4053,11 +4053,11 @@@ fn effects_submenu(ui: &mut egui::Ui, l
}
}
cats.sort_by_key(|(c, _)| c.to_ascii_lowercase());
- widgets::menu_scroll(ui, |ui| {
+ widgets::menu_scroll(ui, false, |ui| {
for (cat, mut fx) in cats {
fx.sort_by_key(|e| e.name.to_ascii_lowercase());
- ui.menu_button(cat, |ui| {
+ ui.menu_button(crate::i18n::effects::category(cat), |ui| {
- widgets::menu_scroll(ui, |ui| {
+ widgets::menu_scroll(ui, false, |ui| {
for e in fx {
item(ui, e.name, "effect.apply", json!({"effect": e.id, "layers": layers}));
}