mirror of
https://github.com/storytold/effectcraft.git
synced 2026-10-24 10:09:32 -06:00
Merge pull request #1367 from nanox333/fix/viewer-comp-settings-menu
Viewer: Composition Settings… in the composition's right-click menu
This commit is contained in:
@@ -1281,6 +1281,13 @@ pub fn show(app: &mut EffectcraftApp, ui: &mut egui::Ui, rect: Rect) {
|
||||
context_actions.push(("comp.copyFrame".to_owned(), serde_json::json!({"comp": cid.0})));
|
||||
ui.close();
|
||||
}
|
||||
// The comp this viewer shows, which is not always the active one.
|
||||
let settings = ui.button(crate::i18n::tr("Composition Settings…"));
|
||||
app.auto.add("viewer.context.settings", settings.rect, "Composition Settings…");
|
||||
if settings.clicked() {
|
||||
context_actions.push(("comp.settings".to_owned(), serde_json::json!({"comp": cid.0})));
|
||||
ui.close();
|
||||
}
|
||||
});
|
||||
for (id, params) in context_actions {
|
||||
if let Err(e) = crate::menus::invoke(app, &ctx, &id, params) {
|
||||
|
||||
@@ -87,6 +87,20 @@ fn timeline_blank_menu_opens_solid_settings() {
|
||||
assert_eq!(h.state().dialog, Some(Dialog::SolidSettings));
|
||||
}
|
||||
|
||||
/// Right-clicking the composition in the viewer offers Composition Settings…, which opens on the
|
||||
/// comp the viewer shows.
|
||||
#[test]
|
||||
fn viewer_menu_opens_composition_settings() {
|
||||
let mut h = harness();
|
||||
let comp = h.state().session.active_comp_id().unwrap();
|
||||
let p = rect(&h, "viewer.comp").center();
|
||||
right_click(&mut h, p);
|
||||
h.get_by_label("Composition Settings…").click();
|
||||
h.run_steps(3);
|
||||
assert_eq!(h.state().dialog, Some(Dialog::CompSettings));
|
||||
assert_eq!(h.state().session.active_comp_id(), Some(comp));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn project_item_and_timeline_layer_keep_their_own_context_menus() {
|
||||
let mut h = harness();
|
||||
|
||||
Reference in New Issue
Block a user