mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-25 02:07:09 -06:00
Merge pull request #2999 from nrq6993-a11y/stream/vc-feat-2991-isolation-shortcut
Allow assigning a keyboard shortcut to Enter Isolation Mode
This commit is contained in:
@@ -227,7 +227,7 @@ pub fn specs() -> Vec<CommandSpec> {
|
||||
has_selection,
|
||||
|s, _| clip_edit(s, true)
|
||||
),
|
||||
cmd!("object.isolate", "Enter Isolation Mode", [], None, "{id}", has_doc, isolate),
|
||||
cmd!("object.isolate", "Enter Isolation Mode", [], None, "{id?} (default: the selection's first object)", has_doc, isolate),
|
||||
cmd!("object.exitIsolation", "Exit Isolation Mode", [], None, "{}", has_doc, exit_isolation),
|
||||
cmd!(
|
||||
"object.setProps",
|
||||
|
||||
@@ -1280,6 +1280,17 @@ fn next_object_above_and_below_pass_over_what_cant_be_selected() {
|
||||
assert_eq!(selected(&s), vec![a]);
|
||||
}
|
||||
|
||||
/// A keyboard shortcut runs `object.isolate` with no params; the first selected object is isolated (#2991).
|
||||
#[test]
|
||||
fn object_isolate_without_id_uses_the_selection() {
|
||||
let mut s = session();
|
||||
let a = rect(&mut s, 0.0, 0.0, 50.0, 50.0);
|
||||
let _b = rect(&mut s, 100.0, 0.0, 50.0, 50.0);
|
||||
sel(&mut s, &[a]);
|
||||
s.execute("object.isolate", &json!({})).unwrap();
|
||||
assert_eq!(s.doc().unwrap().isolation, Some(a));
|
||||
}
|
||||
|
||||
/// In isolation mode Select › Same and Select › Object select only objects in the isolated group.
|
||||
#[test]
|
||||
fn select_menu_commands_stay_inside_the_isolated_group() {
|
||||
|
||||
@@ -1014,4 +1014,16 @@ mod tests {
|
||||
assert!(assign(&mut ov, "symbol.breakLink", Some("Cmd+Alt+Shift+F9"), true).is_ok());
|
||||
assert_eq!(effective_in(&ov, "symbol.breakLink").as_deref(), Some("Cmd+Alt+Shift+F9"));
|
||||
}
|
||||
|
||||
/// #2991: Enter Isolation Mode has no default key but runs on the selection, so it belongs in
|
||||
/// Edit › Keyboard Shortcuts.
|
||||
#[test]
|
||||
fn enter_isolation_mode_command_is_listed_and_assignable() {
|
||||
let e = entry("object.isolate").expect("listed");
|
||||
assert_eq!((e.label.as_str(), e.group.as_str(), e.is_tool), ("Enter Isolation Mode", "Object", false));
|
||||
assert_eq!(default_of("object.isolate"), None);
|
||||
let mut ov = BTreeMap::new();
|
||||
assign(&mut ov, "object.isolate", Some("Cmd+Alt+Shift+F11"), false).unwrap();
|
||||
assert_eq!(effective_in(&ov, "object.isolate").as_deref(), Some("Cmd+Alt+Shift+F11"));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user