From 118c1068397a00f53445370d5bb3b8ab79256944 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Wed, 11 Nov 2026 15:58:38 -0800 Subject: [PATCH] Control bar: an Align To menu follows the Align buttons The Control bar shows an Align To menu after its Align buttons. The menu shows the icon of the choice the Align panel's Align To shows (Artboard while one object is selected), and it lists Align to Selection, Align to Key Object and Align to Artboard with that choice checked. A pick sets the same choice as the Align panel's Align To buttons, which now call the same function. Align to Key Object is off while no key object can be made. Screen readers get a combo box named "Align To:" whose value is the choice. When the bar runs short of room, it drops the Distribute buttons first, then the Align To menu, then the Align buttons. The public documentation offers Align To in the Control panel as well as in the Align panel: https://web.archive.org/web/20250115013546/https://helpx.adobe.com/illustrator/using/moving-aligning-distributing-objects.html --- crates/ui-egui/src/chrome/control_bar.rs | 23 ++-- crates/ui-egui/src/chrome/tests.rs | 107 ++++++++++++++- crates/ui-egui/src/panels/align.rs | 131 ++++++++++++++----- crates/ui-egui/src/panels/paragraph/tests.rs | 12 +- docs/target-app-parity.md | 1 + 5 files changed, 229 insertions(+), 45 deletions(-) diff --git a/crates/ui-egui/src/chrome/control_bar.rs b/crates/ui-egui/src/chrome/control_bar.rs index 1c326609ee..6d854ab4b2 100644 --- a/crates/ui-egui/src/chrome/control_bar.rs +++ b/crates/ui-egui/src/chrome/control_bar.rs @@ -180,7 +180,8 @@ fn inline_transform_width(ui: &Ui, t: &Tokens) -> f32 { labels + fields + crate::panels::transform::CONSTRAIN_LINK_SIZE + ui.spacing().item_spacing.x * items as f32 } -/// The size of the Control bar's Align, Distribute and area type vertical alignment buttons. +/// The size of the Control bar's Align, Distribute and area type vertical alignment buttons, and +/// the height of its Align To menu. const BUTTON: f32 = 24.0; /// The space ahead of the separator that ends a group of the Control bar's controls. @@ -219,8 +220,9 @@ fn separator_width(ui: &Ui) -> f32 { /// The room the controls at the end of the Control bar need: the Transform link, or Document Setup /// and Preferences with nothing selected. The groups ahead of them (the Paragraph section, area -/// type's vertical alignment, the Align and Distribute buttons) show only while it is left, so -/// the bar trims them from its right end (#5372), after the inline X/Y/W/H fields. +/// type's vertical alignment, the Align buttons, the Align To menu and the Distribute buttons) show +/// only while it is left, so the bar trims them from its right end (#5372), after the inline +/// X/Y/W/H fields. fn end_width(ui: &Ui, nothing_selected: bool) -> f32 { if nothing_selected { DOCUMENT_SETUP_WIDTH + ui.spacing().item_spacing.x + PREFERENCES_WIDTH } else { crate::panels::transform::link_width(ui) } } @@ -228,9 +230,9 @@ fn end_width(ui: &Ui, nothing_selected: bool) -> f32 { /// Draws the Control bar's groups between its Character controls and the Transform link, and /// returns whether the Transform link and X/Y/W/H follow (false: nothing is selected, and Document /// Setup and Preferences, drawn here, end the bar). The groups are the Paragraph section and area -/// type's vertical alignment (#3759), then the Align buttons and, for two or more objects, the -/// Distribute buttons (a single object keeps the bar as it was); each shows only while the end of -/// the bar keeps its room. +/// type's vertical alignment (#3759), then the Align buttons, the Align To menu and, for two or more +/// objects, the Distribute buttons (a single object keeps the bar as it was); each shows only while +/// the end of the bar keeps its room. fn groups_before_transform(app: &mut VectorcraftApp, ui: &mut Ui, objects: usize) -> bool { let nothing = objects == 0; if crate::panels::paragraph::control_bar(app, ui, BUTTON, |ui| group_end_width(ui) + end_width(ui, nothing)) { @@ -254,9 +256,12 @@ fn groups_before_transform(app: &mut VectorcraftApp, ui: &mut Ui, objects: usize let end = separator_width(ui) + end_width(ui, false); if ui.available_width() >= buttons_width(ui, 7) + end { crate::panels::align::align_buttons(app, ui, BUTTON); - if objects > 1 && ui.available_width() >= GROUP_GAP + buttons_width(ui, 6) + end { - ui.add_space(GROUP_GAP); - crate::panels::align::distribute_buttons(app, ui, BUTTON); + if ui.available_width() >= crate::panels::align::align_to_menu_width(BUTTON) + ui.spacing().item_spacing.x + end { + crate::panels::align::align_to_menu(app, ui, BUTTON); + if objects > 1 && ui.available_width() >= GROUP_GAP + buttons_width(ui, 6) + end { + ui.add_space(GROUP_GAP); + crate::panels::align::distribute_buttons(app, ui, BUTTON); + } } separator(ui); } diff --git a/crates/ui-egui/src/chrome/tests.rs b/crates/ui-egui/src/chrome/tests.rs index 745c477c78..f9e15f3adb 100644 --- a/crates/ui-egui/src/chrome/tests.rs +++ b/crates/ui-egui/src/chrome/tests.rs @@ -2375,6 +2375,109 @@ fn the_control_bar_shows_the_distribute_buttons_for_two_or_more_objects() { assert_eq!((left(&app, &a), left(&app, &b), left(&app, &c)), (10.0, 105.0, 200.0), "{}", app.ui.status); } +/// The Control bar's Align To menu follows its Align buttons. It shows the Align panel's Align To +/// choice (Artboard for one object, which the buttons align to the artboard) and screen readers +/// get it as the value of a combo box named "Align To:". Its menu checks that choice, has Align to +/// Key Object off while no key object can be made, and a pick chooses as the Align panel does: +/// Artboard and Selection are stored with the UI state and let go of the key object, and Key +/// Object makes the topmost selected object the key, keeping the stored choice. The Align +/// buttons then align to the choice. +#[test] +fn the_control_bar_align_to_menu_chooses_what_align_aligns_to() { + crate::i18n::set_current(crate::i18n::Lang::EN); + let mut app = crate::VectorcraftApp::new(Session::new(), Default::default()); + app.run("file.new", json!({"width": 400, "height": 200})).unwrap(); + let rect = |app: &mut crate::VectorcraftApp, x: f64| { + app.run("shape.rectangle", json!({"x": x, "y": 40, "width": 30, "height": 20})).unwrap()["id"].clone() + }; + let (a, b) = (rect(&mut app, 50.0), rect(&mut app, 150.0)); + let ctx = egui::Context::default(); + ctx.enable_accesskit(); + crate::theme::install_fonts(&ctx); + let screen = egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(1600.0, 300.0)); + let frame = |app: &mut crate::VectorcraftApp, events: Vec| { + let mut out = ctx.run_ui(egui::RawInput { events, screen_rect: Some(screen), ..Default::default() }, |ui| super::control_bar(app, ui)); + out.textures_delta.clear(); + out.platform_output.accesskit_update.map(|u| u.nodes).unwrap_or_default() + }; + type Nodes = Vec<(egui::accesskit::NodeId, egui::accesskit::Node)>; + // A control by its name; a menu row's name follows its check column. + let find = |nodes: &Nodes, name: &str| { + nodes.iter().find(|(_, n)| n.label().is_some_and(|l| l.trim_start_matches(['✓', ' ']) == name)).map(|(_, n)| n.clone()) + }; + let center = |n: &egui::accesskit::Node| { + let b = n.bounds().unwrap_or_else(|| panic!("{n:?}")); + egui::pos2(((b.x0 + b.x1) / 2.0) as f32, ((b.y0 + b.y1) / 2.0) as f32) + }; + let click = |app: &mut crate::VectorcraftApp, at: egui::Pos2| { + let press = |pressed| egui::Event::PointerButton { pos: at, button: egui::PointerButton::Primary, pressed, modifiers: Default::default() }; + frame(app, vec![egui::Event::PointerMoved(at), press(true)]); + frame(app, vec![press(false)]); + frame(app, vec![]); + frame(app, vec![]) + }; + let menu = |app: &mut crate::VectorcraftApp| { + frame(app, vec![]); + let nodes = frame(app, vec![]); + find(&nodes, "Align To:").unwrap_or_else(|| panic!("the Control bar has the Align To menu")) + }; + // Opens the menu, checks its rows and picks `pick`, or closes it with Escape. + let choose = |app: &mut crate::VectorcraftApp, checked: &str, key_on: bool, pick: Option<&str>| { + let at = center(&menu(app)); + let nodes = click(app, at); + for name in ["Align to Selection", "Align to Key Object", "Align to Artboard"] { + let row = find(&nodes, name).unwrap_or_else(|| panic!("the menu lists {name}")); + assert_eq!(row.label().is_some_and(|l| l.starts_with('✓')), name == checked, "{name} checked"); + assert_eq!(row.is_disabled(), name == "Align to Key Object" && !key_on, "{name} off"); + } + let nodes = match pick { + Some(pick) => click(app, center(&find(&nodes, pick).unwrap_or_else(|| panic!("{pick}")))), + None => { + let escape = + |pressed| egui::Event::Key { key: egui::Key::Escape, physical_key: None, pressed, repeat: false, modifiers: Default::default() }; + frame(app, vec![escape(true)]); + frame(app, vec![escape(false)]); + frame(app, vec![]) + } + }; + assert!(find(&nodes, "Align to Artboard").is_none(), "the menu closes"); + }; + let key = |app: &crate::VectorcraftApp| app.session.active().unwrap().selection.key; + let x0 = |app: &crate::VectorcraftApp, id: &serde_json::Value| { + app.session.active().unwrap().doc.node(vectorcraft_doc::NodeId(id.as_u64().unwrap())).unwrap().geometric_bounds().unwrap().x0 + }; + + // One object: the buttons align it to the artboard, and Align to Key Object is off. + app.run("select.set", json!({"ids": [a]})).unwrap(); + let m = menu(&mut app); + assert_eq!(m.role(), egui::accesskit::Role::ComboBox); + assert_eq!(m.value(), Some("Align to Artboard"), "one object shows Artboard"); + choose(&mut app, "Align to Artboard", false, None); + assert_eq!(key(&app), None); + + // Two objects: the stored choice, Selection. + app.run("select.set", json!({"ids": [a, b]})).unwrap(); + assert_eq!(menu(&mut app).value(), Some("Align to Selection")); + choose(&mut app, "Align to Selection", true, Some("Align to Artboard")); + assert_eq!(app.ui.align_to, crate::panels::align::AlignTo::Artboard, "the choice the Align panel shows"); + assert_eq!(menu(&mut app).value(), Some("Align to Artboard")); + let left = find(&frame(&mut app, vec![]), "Horizontal Align Left").unwrap_or_else(|| panic!("Horizontal Align Left")); + click(&mut app, center(&left)); + assert_eq!((x0(&app, &a), x0(&app, &b)), (0.0, 0.0), "aligned to the artboard: {}", app.ui.status); + + // Key Object makes the topmost the key and keeps the stored choice. + choose(&mut app, "Align to Artboard", true, Some("Align to Key Object")); + assert_eq!(key(&app), Some(vectorcraft_doc::NodeId(b.as_u64().unwrap())), "the topmost object is the key"); + assert_eq!(app.ui.align_to, crate::panels::align::AlignTo::Artboard, "the stored choice stays"); + assert_eq!(menu(&mut app).value(), Some("Align to Key Object")); + + // Selection lets go of the key and is stored. + choose(&mut app, "Align to Key Object", true, Some("Align to Selection")); + assert_eq!(key(&app), None, "the key object is let go"); + assert_eq!(app.ui.align_to, crate::panels::align::AlignTo::Selection); + assert_eq!(menu(&mut app).value(), Some("Align to Selection")); +} + /// The Control bar shows the Global Edit Options dropdown while Start Global Edit can run. Its /// options are the session's, which the Properties panel's dropdown also sets: Match Size from /// the Control bar narrows the Results and the objects Start Global Edit takes. The dropdown is off @@ -2477,7 +2580,8 @@ fn the_control_bar_shows_the_inline_transform_fields_only_when_they_fit() { crate::theme::install_fonts(&ctx); let mut seen = false; let mut menu_seen = false; - // The Align group, then for two objects the Distribute group (#5372): each by its controls. + // The Align group and the Align To menu, then for two objects the Distribute group (#5372): + // each by its controls. let mut groups: Vec<(&str, Vec<&str>)> = vec![( "Align", vec![ @@ -2490,6 +2594,7 @@ fn the_control_bar_shows_the_inline_transform_fields_only_when_they_fit() { "Vertical Align Bottom", ], )]; + groups.push(("Align To", vec!["Align To:"])); if count == 2 { groups.push(( "Distribute", diff --git a/crates/ui-egui/src/panels/align.rs b/crates/ui-egui/src/panels/align.rs index e1076145d3..82005595f0 100644 --- a/crates/ui-egui/src/panels/align.rs +++ b/crates/ui-egui/src/panels/align.rs @@ -233,11 +233,106 @@ fn align_to(app: &VectorcraftApp) -> AlignTo { if has_key(app) { AlignTo::Key } else { app.ui.align_to } } +/// The Align To choices of the Align panel and of the Control bar's Align To menu, in their order. +const ALIGN_TO: [AlignTo; 3] = [AlignTo::Selection, AlignTo::Key, AlignTo::Artboard]; + +/// The icon and the translated name of Align To choice `v`. +fn align_to_icon_name(v: AlignTo) -> (&'static str, &'static str) { + match v { + AlignTo::Selection => ("dc-alignto-selection", tl!("Align to Selection")), + AlignTo::Key => ("dc-alignto-key", tl!("Align to Key Object")), + AlignTo::Artboard => ("dc-alignto-artboard", tl!("Align to Artboard")), + } +} + +/// The Align To choice that the Align panel and the Control bar show chosen: Artboard while one +/// object is selected (the buttons then align it to the artboard), else [`align_to`]. +fn shown_align_to(app: &VectorcraftApp) -> AlignTo { + aligns_to(align_to(app), objects_aligned(app)) +} + +/// Whether Align To choice `v` can be chosen. Align to Key Object needs a key object or a key +/// guide, or something to make one of: two or more selected objects, or a guide selected with +/// objects. +fn can_choose(app: &VectorcraftApp, v: AlignTo) -> bool { + v != AlignTo::Key || selection_len(app) >= 2 || has_key(app) || guide_for_key(app).is_some() +} + +/// Chooses Align To `v`, as the Align panel's Align To buttons and the Control bar's Align To menu +/// do. Align to Key Object makes the topmost selected object the key object, unless there is one +/// already; with one object, a guide selected with it becomes the key. The stored choice stays as +/// it was, and Align To shows it again once the key is cleared. Align to Selection and Align to +/// Artboard store the choice and let go of the key object. +pub(crate) fn choose_align_to(app: &mut VectorcraftApp, v: AlignTo) { + if !can_choose(app, v) { + return; + } + if v == AlignTo::Key { + if !has_key(app) { + match (topmost(app).filter(|_| selection_len(app) >= 2), guide_for_key(app)) { + (Some(id), _) => app.run("select.key", json!({"id": id.0})).ok(), + (None, Some(g)) => app.run("select.key", json!({"guide": g})).ok(), + (None, None) => None, + }; + } + } else { + app.ui.align_to = v; + if has_key(app) { + app.run("select.key", json!({})).ok(); + } + } +} + +/// The width of the Control bar's Align To menu ([`align_to_menu`]) for buttons `size` points +/// square: the icon of the choice and the arrow after it. +pub(crate) fn align_to_menu_width(size: f32) -> f32 { + size + ALIGN_TO_ARROW +} + +/// The width of the arrow of the Control bar's Align To menu. +const ALIGN_TO_ARROW: f32 = 14.0; + +/// The Control bar's Align To menu, next to its Align buttons: the icon of the choice that the +/// Align panel's Align To shows ([`shown_align_to`]) and an arrow, `size` points tall. Its menu +/// lists Align to Selection, Align to Key Object and Align to Artboard with that choice checked, +/// and a pick chooses it as the Align panel does ([`choose_align_to`]). Align to Key Object is off +/// while no key object can be made. Screen readers get a combo box named "Align To:" whose value +/// is the choice. +pub(crate) fn align_to_menu(app: &mut VectorcraftApp, ui: &mut Ui, size: f32) { + let t = crate::theme::Tokens::get(ui.ctx()); + let shown = shown_align_to(app); + let (icon, name) = align_to_icon_name(shown); + let (rect, resp) = ui.allocate_exact_size(egui::vec2(align_to_menu_width(size), size), egui::Sense::click()); + if resp.hovered() { + ui.painter().rect_filled(rect, egui::CornerRadius::same(5), t.hover); + } + let square = egui::Rect::from_min_size(rect.min, egui::vec2(size, size)); + crate::icons::paint(ui, icon, square.shrink((size * 0.2).round()), t.icon); + let arrow = egui::Rect::from_center_size(egui::pos2(square.right() + ALIGN_TO_ARROW / 2.0, rect.center().y), egui::vec2(10.0, 10.0)); + crate::icons::paint(ui, "chevron-down", arrow, t.text_dim); + resp.widget_info(|| egui::WidgetInfo { + current_text_value: Some(name.to_owned()), + ..egui::WidgetInfo::labeled(egui::Role::ComboBox, ui.is_enabled(), tl!("Align To:")) + }); + let resp = resp.on_hover_text(name); + let picked = egui::Popup::menu(&resp).show(|ui| { + let mut picked = None; + for v in ALIGN_TO { + if menu_item(ui, align_to_icon_name(v).1, can_choose(app, v), shown == v) { + picked = Some(v); + } + } + picked + }); + if let Some(v) = picked.and_then(|r| r.inner) { + choose_align_to(app, v); + } +} + pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) { let n = selection_len(app); let guides = selected_guides(app); let can_align = n + guides >= 1; - let to = align_to(app); // `spacing` is the Distribute Spacing value. The Distribute Objects and Distribute Spacing // buttons send it while there is a key object or a key guide (#2143). let spacing = app.ui.align_spacing; @@ -299,36 +394,12 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) { ui.vertical(|ui| { widgets::subheader(ui, tl!("Align To:")); // With one object selected the buttons align it to the artboard, and Align To shows Artboard. - let shown = aligns_to(to, objects_aligned(app)); + let shown = shown_align_to(app); ui.horizontal(|ui| { - for (v, icon, tip) in [ - (AlignTo::Selection, "dc-alignto-selection", tl!("Align to Selection")), - (AlignTo::Key, "dc-alignto-key", tl!("Align to Key Object")), - (AlignTo::Artboard, "dc-alignto-artboard", tl!("Align to Artboard")), - ] { - // A key object is one of two or more selected objects, or a guide selected - // with objects. - let on = v != AlignTo::Key || n >= 2 || has_key(app) || guide_for_key(app).is_some(); - if widgets::icon_button_enabled(ui, icon, tl!(tip), shown == v, on, 28.0).clicked() { - if v == AlignTo::Key { - // The topmost selected object becomes the key object, unless - // there is one already. The Align To choice stays as it was, and - // Align To shows it again once the key is cleared. - // With one object, a guide selected with it becomes the key. - if !has_key(app) { - match (topmost(app).filter(|_| n >= 2), guide_for_key(app)) { - (Some(id), _) => app.run("select.key", json!({"id": id.0})).ok(), - (None, Some(g)) => app.run("select.key", json!({"guide": g})).ok(), - (None, None) => None, - }; - } - } else { - app.ui.align_to = v; - // Aligning to the selection or the artboard lets go of the key object. - if has_key(app) { - app.run("select.key", json!({})).ok(); - } - } + for v in ALIGN_TO { + let (icon, tip) = align_to_icon_name(v); + if widgets::icon_button_enabled(ui, icon, tip, shown == v, can_choose(app, v), 28.0).clicked() { + choose_align_to(app, v); } } }); diff --git a/crates/ui-egui/src/panels/paragraph/tests.rs b/crates/ui-egui/src/panels/paragraph/tests.rs index fe66d367f9..7d3d378259 100644 --- a/crates/ui-egui/src/panels/paragraph/tests.rs +++ b/crates/ui-egui/src/panels/paragraph/tests.rs @@ -699,10 +699,11 @@ fn the_control_bar_shows_the_paragraph_alignment_of_the_selected_type() { } /// #5372: at any width the Control bar trims itself from its right end, ending inside its margin. -/// With type selected the inline X/Y/W/H fields go first, then the Distribute and Align buttons, -/// area type's vertical alignment, the Paragraph buttons and last the Paragraph: link, while the -/// Transform link keeps its room; a wider bar never leaves out what a narrower one showed. For one point -/// type object, area type (its vertical alignment) and two objects (the Distribute buttons). +/// With type selected the inline X/Y/W/H fields go first, then the Distribute buttons, the Align To +/// menu and the Align buttons, area type's vertical alignment, the Paragraph buttons and last the +/// Paragraph: link, while the Transform link keeps its room; a wider bar never leaves out what a +/// narrower one showed. For one point type object, area type (its vertical alignment) and two +/// objects (the Distribute buttons). #[test] fn the_control_bar_trims_its_paragraph_section_after_the_controls_to_its_right() { let ctx = control_bar_ctx(); @@ -717,12 +718,13 @@ fn the_control_bar_trims_its_paragraph_section_after_the_controls_to_its_right() groups.push(("vertical alignment", VERTICAL.to_vec())); } groups.push(("Align", vec!["Horizontal Align Left", "Vertical Align Bottom"])); + groups.push(("Align To", vec!["Align To:"])); if case == "two objects" { groups.push(("Distribute", vec!["Vertical Distribute Top", "Horizontal Distribute Right"])); } groups.push(("X/Y/W/H", vec!["X:", "H:"])); let mut seen = vec![false; groups.len()]; - for width in (600..=2400).step_by(10) { + for width in (600..=2600).step_by(10) { let nodes = control_bar_nodes(&ctx, &mut app, width as f32, vec![]); let inside = |x: f64| x <= f64::from(width) - 10.0; let shown: Vec = groups diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index b4c949f742..54e015679a 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -909,6 +909,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur A marquee selects an Intertwine group only when it reaches one of the group's members, as for a plain group, and it selects a repeat only when it reaches one of the copies the repeat draws. Direct and Group Selection's marquees select the anchor points of an Intertwine group's members, not the group, and Group Selection's E marquee selects the members inside it. A key object needs another selected object outside it. A Shift-click or any other change that leaves one object selected clears the key, and `select.key` sets none on one object or on a group selected with only its own members. With one object selected, the Align panel, the Control bar and the Properties panel align it to the artboard whatever Align To is set to. With two or more objects selected and no key object, Align to Key Object makes the topmost of them the key, whatever order they were selected in, and the Align panel, the Control bar and the Properties panel align to it. Align To keeps its Selection or Artboard choice and shows it again once the key is cleared. + The Control bar has an Align To menu after its Align buttons. The public documentation offers Align to Selection, Align to Key Object and Align to Artboard in the Control panel (VectorCraft's Control bar) as well as in the Align panel ([Move, align, and distribute objects](https://web.archive.org/web/20250115013546/https://helpx.adobe.com/illustrator/using/moving-aligning-distributing-objects.html)). The menu shows the icon of the choice the Align panel's Align To shows, and a pick sets the same choice as the Align panel's buttons do. Align to Key Object is off while no key object can be made. When the bar runs short of room, it drops the Distribute buttons first, then the Align To menu, then the Align buttons. Object › Align aligns objects as the align buttons do: it aligns one object to the active artboard whatever Align To is set to, and otherwise it aligns to the key object while there is one, else to the Align To choice, which is saved with the preferences (`ui.inspect` → `ui.align_to`). With direct-selected anchor points, Object › Align aligns the points to their own bounds. While one object is selected, Align To shows Artboard. Edit › Keyboard Shortcuts lists each of the Align panel's Align Objects, Distribute Objects and Distribute Spacing buttons under Align, with no default shortcut, as the reference app's [release notes](https://web.archive.org/web/20261006170350/https://helpx.adobe.com/illustrator/desktop/new-features/release-notes.html) describe for its Align and Distribute commands. A shortcut set there runs what a click on the button runs, with the Align To choice, the key object and the Distribute Spacing value (`align.horizontalLeft` and the other `align.*` UI commands). The command palette lists `select.key` as Cancel Key Object, and a pick cancels the key object (#541).