From a5de88558f0a8a1b0829c07c63176976d1217e89 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Wed, 18 Nov 2026 02:09:37 -0800 Subject: [PATCH 1/5] Symbols: New Symbol and Delete Symbol read Shift and Alt from their own click MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The New Symbol and Delete Symbol buttons, the art drop on the panel and the menu's New Symbol… and Redefine Symbol read Shift and Alt from the release of the primary button over the control, instead of from the modifiers left at the end of the frame. Letting Shift or Alt go, or clicking elsewhere, later in the same frame no longer changes what the click does. --- crates/ui-egui/src/panels/symbols.rs | 119 +++++++++++++++++++++++---- 1 file changed, 101 insertions(+), 18 deletions(-) diff --git a/crates/ui-egui/src/panels/symbols.rs b/crates/ui-egui/src/panels/symbols.rs index c6cf27acf9..6e99df63ae 100644 --- a/crates/ui-egui/src/panels/symbols.rs +++ b/crates/ui-egui/src/panels/symbols.rs @@ -404,7 +404,7 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) { if !over_symbol && let Some(ids) = widgets::art_drop(ui, &zone) { // Shift held at the release keeps the dropped art as ordinary art. let mut p = json!({ "ids": ids, "type": "dynamic" }); - if modifiers_at_release(ui).shift { + if modifiers_released_in(ui, zone.rect).shift { p["keepArt"] = json!(true); } if let Err(e) = app.run("symbol.new", p) { @@ -452,7 +452,8 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) { } else if new.clicked() { // Alt skips Symbol Options: the symbol is made under the default name, dynamic as the // dialog's default. Shift keeps the selected art as ordinary art, with or without Alt. - let m = ui.input(|i| i.modifiers); + // Both are read as the button went up on it. + let m = modifiers_released_in(ui, new.rect); let (cmd, mut p) = if m.alt { ("symbol.new", json!({"type": "dynamic"})) } else { ("ui.symbolOptions", json!({})) }; if m.shift { p["keepArt"] = json!(true); @@ -465,9 +466,9 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) { // it: the dragged symbol, or every symbol Select All Unused picked when it is one of them. if let Some(name) = symbol_dropped(ui, &trash, &names, uid) { let picked = if marked.contains(&name) { &marked[..] } else { &[] }; - delete(app, picked, Some(&name), super::alt_held(ui)); + delete(app, picked, Some(&name), modifiers_released_in(ui, trash.rect).alt); } else if trash.clicked() { - delete(app, &marked, sel.as_deref(), super::alt_held(ui)); + delete(app, &marked, sel.as_deref(), modifiers_released_in(ui, trash.rect).alt); } }); } @@ -480,17 +481,20 @@ pub fn menu(app: &mut VectorcraftApp, ui: &mut Ui) { let has_sel = app.session.active().is_some_and(|d| !d.selection.is_empty()); let inst = has_instances_selected(app); let name = json!({"name": sel}); - // Shift keeps the selected art as ordinary art instead of making it an instance. - let shift = ui.input(|i| i.modifiers.shift); - let redefine = if shift { json!({"name": sel, "keepArt": true}) } else { name.clone() }; - let new = if shift { json!({"keepArt": true}) } else { json!({}) }; - let items: [(&str, bool, &str, Value); 3] = [ - (tl!("New Symbol…"), has_sel, "ui.symbolOptions", new), - (tl!("Redefine Symbol"), has_sel && sel.is_some(), "symbol.update", redefine), - (tl!("Duplicate Symbol"), sel.is_some(), "symbol.duplicate", name.clone()), + // Shift, held as the button went up on New Symbol… or Redefine Symbol, keeps the selected art + // as ordinary art instead of making it an instance. + let items: [(&str, bool, &str, Value, bool); 3] = [ + (tl!("New Symbol…"), has_sel, "ui.symbolOptions", json!({}), true), + (tl!("Redefine Symbol"), has_sel && sel.is_some(), "symbol.update", name.clone(), true), + (tl!("Duplicate Symbol"), sel.is_some(), "symbol.duplicate", name.clone(), false), ]; - for (label, enabled, cmd, params) in items { + for (label, enabled, cmd, mut params, keeps_art) in items { + let top = ui.cursor().min.y; if menu_item(ui, label, enabled, false) { + let row = egui::Rect::from_x_y_ranges(ui.max_rect().x_range(), top..=ui.cursor().min.y); + if keeps_art && modifiers_released_in(ui, row).shift { + params["keepArt"] = json!(true); + } app.run(cmd, params).ok(); } } @@ -589,18 +593,33 @@ fn art_redefine_drop(ui: &Ui, item: &egui::Response, doc: &Document, uid: Option item.dnd_release_payload::().map(|_| ids.iter().map(|id| id.0).collect()) } -/// Whether Alt (Option) is held for a drop: when the primary button went up in this frame, as it -/// went up, else now. +/// Whether Alt (Option) is held for a click or a drop: when the primary button went up in this +/// frame, as it went up, else now. fn alt_at_release(ui: &Ui) -> bool { modifiers_at_release(ui).alt } -/// The modifiers held for a drop: when the primary button went up in this frame, as it went up, -/// else now. +/// The modifiers held for a click or a drop on `rect`: when the primary button last went up over +/// `rect` in this frame, as it went up, else as [`modifiers_at_release`] gives them. +fn modifiers_released_in(ui: &Ui, rect: egui::Rect) -> egui::Modifiers { + ui.input(|i| { + i.events.iter().rev().find_map(|e| match e { + egui::Event::PointerButton { pos, button: egui::PointerButton::Primary, pressed: false, modifiers } if rect.contains(*pos) => { + Some(*modifiers) + } + _ => None, + }) + }) + .unwrap_or_else(|| modifiers_at_release(ui)) +} + +/// The modifiers held for a click or a drop: when the primary button went up in this frame, as it +/// last went up (egui reports the click of the last release in the frame), else now. fn modifiers_at_release(ui: &Ui) -> egui::Modifiers { ui.input(|i| { i.events .iter() + .rev() .find_map(|e| match e { egui::Event::PointerButton { button: egui::PointerButton::Primary, pressed: false, modifiers, .. } => Some(*modifiers), _ => None, @@ -1045,6 +1064,69 @@ mod tests { assert_eq!(art(&app, "New Symbol 2"), (1, 0), "without Shift the rectangle becomes an instance"); } + /// A click of the primary button off the panel with no modifiers held, the pointer then back + /// at `at`. + fn stray_click(at: Pos2) -> [egui::Event; 4] { + let off = pos2(-10.0, -10.0); + let button = + |pressed| egui::Event::PointerButton { pos: off, button: egui::PointerButton::Primary, pressed, modifiers: egui::Modifiers::NONE }; + [egui::Event::PointerMoved(off), button(true), button(false), egui::Event::PointerMoved(at)] + } + + /// Clicks the panel button labeled `label` with `modifiers` held as the primary button goes up, + /// between two clicks off the panel without them, and lets them go later in the same frame. + fn click_button_let_go(app: &mut VectorcraftApp, label: &str, modifiers: egui::Modifiers) { + let ctx = egui::Context::default(); + ctx.enable_accesskit(); + let out = frame_held(&ctx, app, vec![], modifiers); + let at = clickable(&out).into_iter().find(|(l, _)| l == label).unwrap_or_else(|| panic!("a {label} button")).1; + let press = |pressed| egui::Event::PointerButton { pos: at, button: egui::PointerButton::Primary, pressed, modifiers }; + let let_go = egui::Event::ModifiersChanged(egui::Modifiers::NONE); + let mut events = stray_click(at).to_vec(); + events.extend([press(true), press(false), let_go]); + events.extend(stray_click(at)); + frame_held(&ctx, app, events, modifiers); + } + + /// Clicks the menu item labeled `label` with `modifiers` held as the primary button goes up, + /// between two clicks off the menu without them, and lets them go later in the same frame. + fn click_menu_let_go(ctx: &egui::Context, app: &mut VectorcraftApp, label: &str, modifiers: egui::Modifiers) { + let held = egui::Event::ModifiersChanged(modifiers); + let labels = menu_frame(ctx, app, vec![held.clone()]); + let item = labels.iter().find(|(t, _)| t.trim() == label).map(|(_, r)| r.center()).unwrap_or_else(|| panic!("{label} in the menu")); + let press = |pressed| egui::Event::PointerButton { pos: item, button: egui::PointerButton::Primary, pressed, modifiers }; + let mut events = vec![held]; + events.extend(stray_click(item)); + events.extend([press(true), press(false), egui::Event::ModifiersChanged(egui::Modifiers::NONE)]); + events.extend(stray_click(item)); + menu_frame(ctx, app, events); + } + + /// The New Symbol and Delete Symbol buttons and the menu's New Symbol… and Redefine Symbol read + /// Shift and Alt as the primary button goes up on them, though clicks elsewhere without them + /// come before and after and they are let go later in the same frame. + #[test] + fn symbol_clicks_read_the_modifiers_as_the_button_goes_up() { + let (mut app, rect) = leaf_dot_and_rect(); + click_button_let_go(&mut app, "New Symbol", egui::Modifiers::SHIFT | egui::Modifiers::ALT); + assert_eq!(dialog_kind(&app), None, "Alt skips Symbol Options"); + assert_eq!(symbols(&mut app), ["Leaf", "Dot", "New Symbol"]); + assert_eq!(art(&app, "New Symbol"), (0, 1), "Shift: the rectangle stays ordinary art"); + let ctx = egui::Context::default(); + crate::theme::install_fonts(&ctx); + click_menu_let_go(&ctx, &mut app, "New Symbol…", egui::Modifiers::SHIFT); + crate::dialogs::confirm(&mut app).unwrap(); + assert_eq!(art(&app, "New Symbol 2"), (0, 1), "the menu's Shift keeps the rectangle as ordinary art"); + app.run("symbol.setCurrent", json!({"name": "Dot"})).unwrap(); + click_menu_let_go(&ctx, &mut app, "Redefine Symbol", egui::Modifiers::SHIFT); + assert_eq!(art(&app, "Dot"), (0, 1), "Redefine Symbol with Shift keeps the rectangle as ordinary art"); + assert_eq!(app.session.active().unwrap().selection.objects, vec![rect]); + // Dot holds the rectangle now and nothing places it, so Alt deletes it without asking. + click_button_let_go(&mut app, "Delete Symbol", egui::Modifiers::ALT); + assert_eq!(dialog_kind(&app), None, "Alt deletes an unused symbol without asking"); + assert_eq!(symbols(&mut app), ["Leaf", "New Symbol", "New Symbol 2"]); + } + /// `ui.symbolOptions` takes `keepArt` only as true or false, and only for a new symbol. #[test] fn symbol_options_checks_keep_art() { @@ -2425,7 +2507,8 @@ mod tests { frame(ctx, app, vec![egui::Event::PointerMoved(from + vec2(40.0, 40.0))]); frame(ctx, app, vec![egui::Event::PointerMoved(from + vec2(80.0, 80.0))]); let held = frame_held(ctx, app, vec![egui::Event::PointerMoved(to)], egui::Modifiers::NONE); - frame_held(ctx, app, vec![button(to, false)], modifiers); + let release = egui::Event::PointerButton { pos: to, button: egui::PointerButton::Primary, pressed: false, modifiers }; + frame_held(ctx, app, vec![release], modifiers); held } From 6c2e9c5b1a70c0c4cf3e3f1e4d02945904f4c9c2 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Wed, 18 Nov 2026 15:25:30 -0800 Subject: [PATCH 2/5] Symbols: drops read the release that ends the drag; other clicks use held keys A drop of art on the panel, art on a symbol and a symbol on Delete Symbol read Shift or Alt from the first primary release in the frame, which is the one that ends the drag. A later click in the same frame no longer turns a Shift drop into an instance, a plain drop into Redefine Symbol, or a plain drop on Delete Symbol into a delete without asking. New Symbol, Delete Symbol and the menu items still read the release over them. A click with no such release, from the keyboard or a screen reader, uses the keys held now instead of an unrelated release. --- crates/ui-egui/src/panels/symbols.rs | 130 ++++++++++++++++++++++----- 1 file changed, 109 insertions(+), 21 deletions(-) diff --git a/crates/ui-egui/src/panels/symbols.rs b/crates/ui-egui/src/panels/symbols.rs index a28aa8769c..a94ce33be1 100644 --- a/crates/ui-egui/src/panels/symbols.rs +++ b/crates/ui-egui/src/panels/symbols.rs @@ -403,9 +403,9 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) { }); let zone = ui.interact(list_rect, ui.scope_id().with("symbols-drop"), Sense::hover()); if !over_symbol && let Some(ids) = widgets::art_drop(ui, &zone) { - // Shift held at the release keeps the dropped art as ordinary art. + // Shift held at the release that ends the drag keeps the dropped art as ordinary art. let mut p = json!({ "ids": ids, "type": "dynamic" }); - if modifiers_released_in(ui, zone.rect).shift { + if modifiers_at_release(ui).shift { p["keepArt"] = json!(true); } if let Err(e) = app.run("symbol.new", p) { @@ -472,7 +472,7 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) { // it: the dragged symbol, or every symbol Select All Unused picked when it is one of them. if let Some(name) = symbol_dropped(ui, &trash, &names, uid) { let picked = if marked.contains(&name) { &marked[..] } else { &[] }; - delete(app, picked, Some(&name), modifiers_released_in(ui, trash.rect).alt); + delete(app, picked, Some(&name), alt_at_release(ui)); } else if trash.clicked() { delete(app, &marked, sel.as_deref(), modifiers_released_in(ui, trash.rect).alt); } @@ -599,33 +599,35 @@ fn art_redefine_drop(ui: &Ui, item: &egui::Response, doc: &Document, uid: Option item.dnd_release_payload::().map(|_| ids.iter().map(|id| id.0).collect()) } -/// Whether Alt (Option) is held for a click or a drop: when the primary button went up in this -/// frame, as it went up, else now. +/// Whether Alt (Option) is held for a drop: as [`modifiers_at_release`] gives it. fn alt_at_release(ui: &Ui) -> bool { modifiers_at_release(ui).alt } -/// The modifiers held for a click or a drop on `rect`: when the primary button last went up over -/// `rect` in this frame, as it went up, else as [`modifiers_at_release`] gives them. +/// The modifiers held for a click on `rect`: when the primary button last went up over `rect` in +/// this frame, as it went up (egui reports the click of the last release in the frame), else now, +/// as for a click from the keyboard or a screen reader. fn modifiers_released_in(ui: &Ui, rect: egui::Rect) -> egui::Modifiers { - ui.input(|i| { - i.events.iter().rev().find_map(|e| match e { - egui::Event::PointerButton { pos, button: egui::PointerButton::Primary, pressed: false, modifiers } if rect.contains(*pos) => { - Some(*modifiers) - } - _ => None, - }) - }) - .unwrap_or_else(|| modifiers_at_release(ui)) -} - -/// The modifiers held for a click or a drop: when the primary button went up in this frame, as it -/// last went up (egui reports the click of the last release in the frame), else now. -fn modifiers_at_release(ui: &Ui) -> egui::Modifiers { ui.input(|i| { i.events .iter() .rev() + .find_map(|e| match e { + egui::Event::PointerButton { pos, button: egui::PointerButton::Primary, pressed: false, modifiers } if rect.contains(*pos) => { + Some(*modifiers) + } + _ => None, + }) + .unwrap_or(i.modifiers) + }) +} + +/// The modifiers held for a drop: when the primary button went up in this frame, as it first went +/// up, which is the release that ends a drag under way when the frame starts; else now. +fn modifiers_at_release(ui: &Ui) -> egui::Modifiers { + ui.input(|i| { + i.events + .iter() .find_map(|e| match e { egui::Event::PointerButton { button: egui::PointerButton::Primary, pressed: false, modifiers, .. } => Some(*modifiers), _ => None, @@ -1177,6 +1179,30 @@ mod tests { assert_eq!(art(&app, "New Symbol 2"), (1, 0), "without Shift the rectangle becomes an instance"); } + /// A drop on the panel reads Shift from the release that ends the drag: a click on the list + /// without Shift later in the same frame keeps a Shift drop's art as ordinary art, and a click + /// with Shift does not keep a plain drop's art. + #[test] + fn a_drop_on_the_panel_reads_shift_from_the_release_that_ends_the_drag() { + let (mut app, rect) = leaf_dot_and_rect(); + let ctx = egui::Context::default(); + let at = pos2(180.0, 60.0); + let release = |modifiers| egui::Event::PointerButton { pos: at, button: egui::PointerButton::Primary, pressed: false, modifiers }; + let press = |modifiers| egui::Event::PointerButton { pos: at, button: egui::PointerButton::Primary, pressed: true, modifiers }; + widgets::drag_art(&ctx, uid(&app).unwrap(), vec![rect]); + frame_held(&ctx, &mut app, vec![egui::Event::PointerMoved(at)], egui::Modifiers::SHIFT); + let plain = egui::Modifiers::NONE; + let events = vec![release(egui::Modifiers::SHIFT), egui::Event::ModifiersChanged(plain), press(plain), release(plain)]; + frame_held(&ctx, &mut app, events, egui::Modifiers::SHIFT); + assert_eq!(art(&app, "New Symbol"), (0, 1), "the Shift drop keeps the rectangle as ordinary art"); + widgets::drag_art(&ctx, uid(&app).unwrap(), vec![rect]); + frame_held(&ctx, &mut app, vec![egui::Event::PointerMoved(at)], plain); + let shift = egui::Modifiers::SHIFT; + let events = vec![release(plain), egui::Event::ModifiersChanged(shift), press(shift), release(shift)]; + frame_held(&ctx, &mut app, events, plain); + assert_eq!(art(&app, "New Symbol 2"), (1, 0), "the plain drop makes the rectangle an instance"); + } + /// A click of the primary button off the panel with no modifiers held, the pointer then back /// at `at`. fn stray_click(at: Pos2) -> [egui::Event; 4] { @@ -2935,6 +2961,68 @@ mod tests { assert!(Arc::ptr_eq(&leaf, &symbol_art(&app, "Leaf")), "Leaf is unchanged"); } + /// A plain art drop on a symbol followed in the same frame by an Alt-click on that symbol makes + /// a new symbol and leaves the symbol as it was: the release that ends the drag decides. + #[test] + fn an_alt_click_after_a_plain_art_drop_in_the_same_frame_does_not_redefine() { + let mut app = leaf_and_dot(); + let shape = app.run("shape.rectangle", json!({"x": 200, "y": 120, "width": 40, "height": 20})).unwrap()["id"].as_u64().unwrap(); + let leaf = symbol_art(&app, "Leaf"); + let ctx = egui::Context::default(); + let at = item_at(&ctx, &mut app, "Leaf"); + widgets::drag_art(&ctx, uid(&app).unwrap(), vec![NodeId(shape)]); + frame_held(&ctx, &mut app, vec![egui::Event::PointerMoved(at)], egui::Modifiers::NONE); + let alt_press = egui::Event::PointerButton { pos: at, button: egui::PointerButton::Primary, pressed: true, modifiers: egui::Modifiers::ALT }; + let events = vec![button(at, false), egui::Event::ModifiersChanged(egui::Modifiers::ALT), alt_press, alt_release(at)]; + frame_held(&ctx, &mut app, events, egui::Modifiers::NONE); + assert_eq!(symbols(&mut app).len(), 3, "a new symbol"); + assert!(Arc::ptr_eq(&leaf, &symbol_art(&app, "Leaf")), "Leaf is unchanged"); + } + + /// A plain drop of an unused symbol on Delete Symbol followed in the same frame by an Alt-click + /// on the button still asks first: the release that ends the drag decides. + #[test] + fn an_alt_click_after_a_plain_drop_on_delete_in_the_same_frame_still_asks() { + let mut app = leaf_and_dot(); + let ctx = egui::Context::default(); + crate::theme::install_fonts(&ctx); + let trash = button_rect(&ctx, &mut app, "Delete Symbol").center(); + let dot = item_at(&ctx, &mut app, "Dot"); + frame(&ctx, &mut app, vec![]); + frame(&ctx, &mut app, vec![egui::Event::PointerMoved(dot), button(dot, true)]); + frame(&ctx, &mut app, vec![egui::Event::PointerMoved(dot + vec2(40.0, 40.0))]); + frame(&ctx, &mut app, vec![egui::Event::PointerMoved(dot + vec2(80.0, 80.0))]); + frame_held(&ctx, &mut app, vec![egui::Event::PointerMoved(trash)], egui::Modifiers::NONE); + let alt_press = + egui::Event::PointerButton { pos: trash, button: egui::PointerButton::Primary, pressed: true, modifiers: egui::Modifiers::ALT }; + let events = vec![button(trash, false), egui::Event::ModifiersChanged(egui::Modifiers::ALT), alt_press, alt_release(trash)]; + frame_held(&ctx, &mut app, events, egui::Modifiers::NONE); + assert_eq!(dialog_kind(&app), Some(crate::dialogs::symbol_delete::KIND), "the plain drop asks first"); + assert_eq!(symbols(&mut app), ["Leaf", "Dot"]); + } + + /// A screen reader's Click on Delete Symbol asks first for an unused symbol, though an Alt-click + /// elsewhere comes before it in the same frame and Alt is let go after. + #[test] + fn a_screen_reader_click_on_delete_does_not_take_alt_from_another_click() { + use egui::accesskit::{Action, ActionRequest, TreeId}; + let mut app = leaf_and_dot(); + let ctx = egui::Context::default(); + ctx.enable_accesskit(); + let out = frame_held(&ctx, &mut app, vec![], egui::Modifiers::NONE); + let nodes = &out.platform_output.accesskit_update.as_ref().expect("an accessibility tree").nodes; + let node = + nodes.iter().find(|(_, n)| n.label().is_some_and(|l| l.trim() == "Delete Symbol")).map(|(id, _)| *id).expect("a Delete Symbol node"); + let off = pos2(-10.0, -10.0); + let alt = |pressed| egui::Event::PointerButton { pos: off, button: egui::PointerButton::Primary, pressed, modifiers: egui::Modifiers::ALT }; + let click = + egui::Event::AccessKitActionRequest(ActionRequest { action: Action::Click, target_node: node, target_tree: TreeId::ROOT, data: None }); + let events = vec![egui::Event::PointerMoved(off), alt(true), alt(false), egui::Event::ModifiersChanged(egui::Modifiers::NONE), click]; + frame_held(&ctx, &mut app, events, egui::Modifiers::ALT); + assert_eq!(dialog_kind(&app), Some(crate::dialogs::symbol_delete::KIND), "the screen reader's Click asks first"); + assert_eq!(symbols(&mut app), ["Leaf", "Dot"]); + } + /// An Alt drop that cannot redefine the symbol under the pointer changes nothing, makes no new /// symbol and adds no undo step: art of another document, objects the document no longer has, /// no objects, and a release away from the panel are not outlined, and art holding an instance From 197f3ed64540f865d62209e5e4394a28780f76a4 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Wed, 18 Nov 2026 16:36:41 -0800 Subject: [PATCH 3/5] Symbols: a click just outside New Symbol or Delete Symbol reads its own modifiers egui counts a release within its interact radius of a button as a click on it. The panel's buttons now read Shift and Alt from such a release too, and skip a release that ends a drag, which egui does not count as a click. --- crates/ui-egui/src/panels/symbols.rs | 107 +++++++++++++++++++++++---- 1 file changed, 93 insertions(+), 14 deletions(-) diff --git a/crates/ui-egui/src/panels/symbols.rs b/crates/ui-egui/src/panels/symbols.rs index a94ce33be1..204b0742c2 100644 --- a/crates/ui-egui/src/panels/symbols.rs +++ b/crates/ui-egui/src/panels/symbols.rs @@ -459,7 +459,7 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) { // Alt skips Symbol Options: the symbol is made under the default name, dynamic as the // dialog's default. Shift keeps the selected art as ordinary art, with or without Alt. // Both are read as the button went up on it. - let m = modifiers_released_in(ui, new.rect); + let m = modifiers_released_in(ui, new.interact_rect); let (cmd, mut p) = if m.alt { ("symbol.new", json!({"type": "dynamic"})) } else { ("ui.symbolOptions", json!({})) }; if m.shift { p["keepArt"] = json!(true); @@ -474,7 +474,7 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) { let picked = if marked.contains(&name) { &marked[..] } else { &[] }; delete(app, picked, Some(&name), alt_at_release(ui)); } else if trash.clicked() { - delete(app, &marked, sel.as_deref(), modifiers_released_in(ui, trash.rect).alt); + delete(app, &marked, sel.as_deref(), modifiers_released_in(ui, trash.interact_rect).alt); } }); } @@ -604,21 +604,42 @@ fn alt_at_release(ui: &Ui) -> bool { modifiers_at_release(ui).alt } -/// The modifiers held for a click on `rect`: when the primary button last went up over `rect` in -/// this frame, as it went up (egui reports the click of the last release in the frame), else now, -/// as for a click from the keyboard or a screen reader. +/// The modifiers held for a click on the widget whose interact rectangle is `rect`: when the +/// primary button last went up in this frame as a click (the pointer stayed within egui's click +/// distance of where the button went down) over `rect` or within egui's interact radius of it +/// (egui counts a release that close as a click on the widget), as it went up (egui reports the +/// click of the last such release in the frame), else now, as for a click from the keyboard or a +/// screen reader. A release that ends a drag is not a click and is skipped. fn modifiers_released_in(ui: &Ui, rect: egui::Rect) -> egui::Modifiers { + let radius = ui.ctx().global_style().interaction.interact_radius; + let max_click_dist = ui.ctx().options(|o| o.input_options.max_click_dist); ui.input(|i| { - i.events - .iter() - .rev() - .find_map(|e| match e { - egui::Event::PointerButton { pos, button: egui::PointerButton::Primary, pressed: false, modifiers } if rect.contains(*pos) => { - Some(*modifiers) + // Where the button went down in this frame, and whether the pointer has since moved too far + // for a click; a press in an earlier frame is taken as the start of a click. + let mut origin: Option = None; + let mut moved = false; + let mut found = None; + for e in &i.events { + match e { + egui::Event::PointerMoved(pos) => { + moved |= origin.is_some_and(|o| o.distance(*pos) > max_click_dist); } - _ => None, - }) - .unwrap_or(i.modifiers) + egui::Event::PointerButton { pos, pressed: true, .. } => { + origin = Some(*pos); + moved = false; + } + egui::Event::PointerButton { pos, button, pressed: false, modifiers } => { + moved |= origin.is_some_and(|o| o.distance(*pos) > max_click_dist); + if *button == egui::PointerButton::Primary && !moved && rect.distance_sq_to_pos(*pos) <= radius * radius { + found = Some(*modifiers); + } + origin = None; + moved = false; + } + _ => {} + } + } + found.unwrap_or(i.modifiers) }) } @@ -1266,6 +1287,64 @@ mod tests { assert_eq!(symbols(&mut app), ["Leaf", "New Symbol", "New Symbol 2"]); } + /// A click just outside New Symbol, which egui still counts as a click on it, reads Shift and + /// Alt as the primary button goes up there, though they are let go later in the same frame. + #[test] + fn a_click_just_outside_new_symbol_reads_the_modifiers_as_the_button_goes_up() { + let (mut app, _) = leaf_dot_and_rect(); + let ctx = egui::Context::default(); + ctx.enable_accesskit(); + let modifiers = egui::Modifiers::SHIFT | egui::Modifiers::ALT; + let out = frame_held(&ctx, &mut app, vec![], modifiers); + let nodes = &out.platform_output.accesskit_update.as_ref().expect("an accessibility tree").nodes; + let b = nodes + .iter() + .find(|(_, n)| n.label().is_some_and(|l| l.trim() == "New Symbol")) + .and_then(|(_, n)| n.bounds()) + .expect("a New Symbol button"); + let at = pos2(b.x0 as f32 - 2.0, ((b.y0 + b.y1) / 2.0) as f32); + let press = |pressed| egui::Event::PointerButton { pos: at, button: egui::PointerButton::Primary, pressed, modifiers }; + let events = vec![egui::Event::PointerMoved(at), press(true), press(false), egui::Event::ModifiersChanged(egui::Modifiers::NONE)]; + frame_held(&ctx, &mut app, events, modifiers); + assert_eq!(dialog_kind(&app), None, "Alt skips Symbol Options"); + assert_eq!(symbols(&mut app), ["Leaf", "Dot", "New Symbol"]); + assert_eq!(art(&app, "New Symbol"), (0, 1), "Shift: the rectangle stays ordinary art"); + } + + /// An Alt-click on Delete Symbol followed in the same frame by a drag that ends just outside + /// it without Alt reads Alt from the click: the release that ends the drag is not a click. + #[test] + fn a_drag_ending_near_delete_symbol_after_an_alt_click_keeps_the_click_modifiers() { + let mut app = leaf_and_dot(); + let ctx = egui::Context::default(); + ctx.enable_accesskit(); + let out = frame_held(&ctx, &mut app, vec![], egui::Modifiers::NONE); + let nodes = &out.platform_output.accesskit_update.as_ref().expect("an accessibility tree").nodes; + let b = nodes + .iter() + .find(|(_, n)| n.label().is_some_and(|l| l.trim() == "Delete Symbol")) + .and_then(|(_, n)| n.bounds()) + .expect("a Delete Symbol button"); + let center = pos2(((b.x0 + b.x1) / 2.0) as f32, ((b.y0 + b.y1) / 2.0) as f32); + let near = pos2(b.x0 as f32 - 1.0, center.y); + let from = pos2(near.x, near.y - 12.0); + let button = |pos, pressed, modifiers| egui::Event::PointerButton { pos, button: egui::PointerButton::Primary, pressed, modifiers }; + let (alt, none) = (egui::Modifiers::ALT, egui::Modifiers::NONE); + let events = vec![ + egui::Event::PointerMoved(center), + button(center, true, alt), + button(center, false, alt), + egui::Event::ModifiersChanged(none), + egui::Event::PointerMoved(from), + button(from, true, none), + egui::Event::PointerMoved(near), + button(near, false, none), + ]; + frame_held(&ctx, &mut app, events, alt); + assert_eq!(dialog_kind(&app), None, "Alt deletes the unused symbol without asking"); + assert_eq!(symbols(&mut app), ["Leaf"]); + } + /// `ui.symbolOptions` takes `keepArt` only as true or false, and only for a new symbol. #[test] fn symbol_options_checks_keep_art() { From 4d3bd79763de377605b81f7ee3e9c55c92ac1700 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Thu, 19 Nov 2026 05:11:47 -0800 Subject: [PATCH 4/5] Symbols: a release that ends a drag begun in an earlier frame gives no modifiers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit New Symbol, Delete Symbol and the panel menu's New Symbol… and Redefine Symbol read the modifiers of a release only when egui reports the control clicked by the pointer. A Click from the keyboard or a screen reader reads the modifiers held now, so an Alt release that ends a drag over Delete Symbol in the same frame no longer deletes without asking. --- crates/ui-egui/src/panels/symbols.rs | 99 ++++++++++++++++++++++++--- crates/ui-egui/src/widgets.rs | 2 +- crates/ui-egui/src/widgets/buttons.rs | 13 +++- 3 files changed, 102 insertions(+), 12 deletions(-) diff --git a/crates/ui-egui/src/panels/symbols.rs b/crates/ui-egui/src/panels/symbols.rs index 204b0742c2..5557b7c8fe 100644 --- a/crates/ui-egui/src/panels/symbols.rs +++ b/crates/ui-egui/src/panels/symbols.rs @@ -459,7 +459,7 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) { // Alt skips Symbol Options: the symbol is made under the default name, dynamic as the // dialog's default. Shift keeps the selected art as ordinary art, with or without Alt. // Both are read as the button went up on it. - let m = modifiers_released_in(ui, new.interact_rect); + let m = modifiers_released_in(ui, new.interact_rect, new.clicked_by(egui::PointerButton::Primary)); let (cmd, mut p) = if m.alt { ("symbol.new", json!({"type": "dynamic"})) } else { ("ui.symbolOptions", json!({})) }; if m.shift { p["keepArt"] = json!(true); @@ -474,7 +474,8 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) { let picked = if marked.contains(&name) { &marked[..] } else { &[] }; delete(app, picked, Some(&name), alt_at_release(ui)); } else if trash.clicked() { - delete(app, &marked, sel.as_deref(), modifiers_released_in(ui, trash.interact_rect).alt); + let pointer = trash.clicked_by(egui::PointerButton::Primary); + delete(app, &marked, sel.as_deref(), modifiers_released_in(ui, trash.interact_rect, pointer).alt); } }); } @@ -496,9 +497,10 @@ pub fn menu(app: &mut VectorcraftApp, ui: &mut Ui) { ]; for (label, enabled, cmd, mut params, keeps_art) in items { let top = ui.cursor().min.y; - if menu_item(ui, label, enabled, false) { + let item = widgets::menu_item_response(ui, label, enabled, false); + if item.clicked() { let row = egui::Rect::from_x_y_ranges(ui.max_rect().x_range(), top..=ui.cursor().min.y); - if keeps_art && modifiers_released_in(ui, row).shift { + if keeps_art && modifiers_released_in(ui, row, item.clicked_by(egui::PointerButton::Primary)).shift { params["keepArt"] = json!(true); } app.run(cmd, params).ok(); @@ -609,15 +611,26 @@ fn alt_at_release(ui: &Ui) -> bool { /// distance of where the button went down) over `rect` or within egui's interact radius of it /// (egui counts a release that close as a click on the widget), as it went up (egui reports the /// click of the last such release in the frame), else now, as for a click from the keyboard or a -/// screen reader. A release that ends a drag is not a click and is skipped. -fn modifiers_released_in(ui: &Ui, rect: egui::Rect) -> egui::Modifiers { +/// screen reader. A release that ends a drag is not a click and is skipped, also when the drag +/// began in an earlier frame. `pointer` is whether egui reports the widget clicked by the primary +/// button; when it is false, the click came from the keyboard or a screen reader and the modifiers +/// held now are used. +fn modifiers_released_in(ui: &Ui, rect: egui::Rect, pointer: bool) -> egui::Modifiers { + if !pointer { + return ui.input(|i| i.modifiers); + } let radius = ui.ctx().global_style().interaction.interact_radius; let max_click_dist = ui.ctx().options(|o| o.input_options.max_click_dist); ui.input(|i| { // Where the button went down in this frame, and whether the pointer has since moved too far - // for a click; a press in an earlier frame is taken as the start of a click. + // for a click. let mut origin: Option = None; let mut moved = false; + // Whether a button went down earlier in this frame; until one does, a release ends a press + // of an earlier frame. + let mut pressed_here = false; + // The modifiers of the release over `rect` that ends a press of an earlier frame. + let mut early = None; let mut found = None; for e in &i.events { match e { @@ -627,11 +640,17 @@ fn modifiers_released_in(ui: &Ui, rect: egui::Rect) -> egui::Modifiers { egui::Event::PointerButton { pos, pressed: true, .. } => { origin = Some(*pos); moved = false; + pressed_here = true; } egui::Event::PointerButton { pos, button, pressed: false, modifiers } => { moved |= origin.is_some_and(|o| o.distance(*pos) > max_click_dist); - if *button == egui::PointerButton::Primary && !moved && rect.distance_sq_to_pos(*pos) <= radius * radius { - found = Some(*modifiers); + let over = rect.distance_sq_to_pos(*pos) <= radius * radius; + if *button == egui::PointerButton::Primary { + if !pressed_here { + early = over.then_some(*modifiers); + } else if !moved && over { + found = Some(*modifiers); + } } origin = None; moved = false; @@ -639,7 +658,9 @@ fn modifiers_released_in(ui: &Ui, rect: egui::Rect) -> egui::Modifiers { _ => {} } } - found.unwrap_or(i.modifiers) + // egui tracks a press of an earlier frame. A widget it reports clicked by the pointer, with + // no click on it after a press of this frame, was clicked by the early release. + found.or(early).unwrap_or(i.modifiers) }) } @@ -1050,6 +1071,21 @@ mod tests { assert_eq!(art(&app, "New Symbol 2"), (1, 0), "without Shift the rectangle becomes an instance"); } + /// A Shift-click on New Symbol… in the panel menu that goes down in one frame and up in the next + /// keeps the art as ordinary art, though a plain click elsewhere follows in the same frame. + #[test] + fn a_shift_click_on_new_symbol_in_the_menu_counts_though_a_click_elsewhere_follows() { + let (mut app, _) = leaf_dot_and_rect(); + let ctx = egui::Context::default(); + crate::theme::install_fonts(&ctx); + let off = pos2(-10.0, -10.0); + let after = vec![egui::Event::PointerMoved(off), button(off, true), button(off, false), egui::Event::ModifiersChanged(egui::Modifiers::NONE)]; + click_menu_held_then(&ctx, &mut app, "New Symbol…", egui::Modifiers::SHIFT, after); + assert_eq!(dialog_kind(&app), Some(crate::dialogs::symbol_options::KIND)); + crate::dialogs::confirm(&mut app).unwrap(); + assert_eq!(art(&app, "New Symbol"), (0, 1), "the rectangle stays ordinary art"); + } + /// Clicks the panel's New Symbol button with `modifiers` held. fn click_new(app: &mut VectorcraftApp, modifiers: egui::Modifiers) { click_button_then(app, "New Symbol", modifiers, vec![]); @@ -3102,6 +3138,49 @@ mod tests { assert_eq!(symbols(&mut app), ["Leaf", "Dot"]); } + /// A screen reader's Click on Delete Symbol asks first for an unused symbol, though in the same + /// frame an Alt release over the button ends a drag that began in an earlier frame and Alt is + /// let go after. + #[test] + fn a_screen_reader_click_on_delete_does_not_take_alt_from_a_drag_begun_earlier() { + use egui::accesskit::{Action, ActionRequest, TreeId}; + let mut app = leaf_and_dot(); + let ctx = egui::Context::default(); + ctx.enable_accesskit(); + let out = frame_held(&ctx, &mut app, vec![], egui::Modifiers::NONE); + let nodes = &out.platform_output.accesskit_update.as_ref().expect("an accessibility tree").nodes; + let node = + nodes.iter().find(|(_, n)| n.label().is_some_and(|l| l.trim() == "Delete Symbol")).map(|(id, _)| *id).expect("a Delete Symbol node"); + let trash = clickable(&out).into_iter().find(|(l, _)| l == "Delete Symbol").expect("a Delete Symbol button").1; + let off = pos2(-10.0, -10.0); + let press = egui::Event::PointerButton { pos: off, button: egui::PointerButton::Primary, pressed: true, modifiers: egui::Modifiers::ALT }; + frame_held(&ctx, &mut app, vec![egui::Event::PointerMoved(off), press], egui::Modifiers::ALT); + frame_held(&ctx, &mut app, vec![egui::Event::PointerMoved(trash - vec2(0.0, 80.0))], egui::Modifiers::ALT); + let click = + egui::Event::AccessKitActionRequest(ActionRequest { action: Action::Click, target_node: node, target_tree: TreeId::ROOT, data: None }); + let events = vec![egui::Event::PointerMoved(trash), alt_release(trash), egui::Event::ModifiersChanged(egui::Modifiers::NONE), click]; + frame_held(&ctx, &mut app, events, egui::Modifiers::ALT); + assert_eq!(dialog_kind(&app), Some(crate::dialogs::symbol_delete::KIND), "the screen reader's Click asks first"); + assert_eq!(symbols(&mut app), ["Leaf", "Dot"]); + } + + /// A click on Delete Symbol that goes down in one frame and up with Alt held in the next deletes + /// an unused symbol without asking, though a plain click elsewhere follows in the same frame. + #[test] + fn an_alt_click_on_delete_across_frames_counts_though_a_click_elsewhere_follows() { + let mut app = leaf_and_dot(); + let ctx = egui::Context::default(); + ctx.enable_accesskit(); + let out = frame_held(&ctx, &mut app, vec![], egui::Modifiers::NONE); + let trash = clickable(&out).into_iter().find(|(l, _)| l == "Delete Symbol").expect("a Delete Symbol button").1; + frame_held(&ctx, &mut app, vec![egui::Event::PointerMoved(trash), button(trash, true)], egui::Modifiers::ALT); + let off = pos2(-10.0, -10.0); + let events = vec![alt_release(trash), egui::Event::PointerMoved(off), button(off, true), button(off, false)]; + frame_held(&ctx, &mut app, events, egui::Modifiers::ALT); + assert_eq!(dialog_kind(&app), None, "Alt deletes an unused symbol without asking"); + assert_eq!(symbols(&mut app), ["Leaf"]); + } + /// An Alt drop that cannot redefine the symbol under the pointer changes nothing, makes no new /// symbol and adds no undo step: art of another document, objects the document no longer has, /// no objects, and a release away from the panel are not outlined, and art holding an instance diff --git a/crates/ui-egui/src/widgets.rs b/crates/ui-egui/src/widgets.rs index d6a0f7c50e..c0d6459c30 100644 --- a/crates/ui-egui/src/widgets.rs +++ b/crates/ui-egui/src/widgets.rs @@ -31,7 +31,7 @@ pub use buttons::{ primary_button_enabled, secondary_button, split_button, split_button_named, toggle_icon, }; pub(crate) use buttons::{ - button_width, flat_button_fit_width, icon_button_info, paint_icon_button_named, primary_button_width, secondary_button_width, + button_width, flat_button_fit_width, icon_button_info, menu_item_response, paint_icon_button_named, primary_button_width, secondary_button_width, }; #[cfg(test)] use chips::gradient_chip_colors; diff --git a/crates/ui-egui/src/widgets/buttons.rs b/crates/ui-egui/src/widgets/buttons.rs index 19062eaf4c..6fb586a43c 100644 --- a/crates/ui-egui/src/widgets/buttons.rs +++ b/crates/ui-egui/src/widgets/buttons.rs @@ -213,9 +213,20 @@ pub fn menu_item(ui: &mut Ui, label: &str, enabled: bool, checked: bool) -> bool menu_item_name(ui, tl!(label), enabled, checked) } +/// [`menu_item`] that returns the row's response, for a caller that needs to know how it was +/// clicked. +pub(crate) fn menu_item_response(ui: &mut Ui, label: &str, enabled: bool, checked: bool) -> egui::Response { + menu_item_name_response(ui, tl!(label), enabled, checked) +} + /// [`menu_item`] for a name that is user or file data (a library, a recent URL), never translated. /// Like the menu bar's items, the row lights up under the pointer. pub fn menu_item_name(ui: &mut Ui, label: &str, enabled: bool, checked: bool) -> bool { + menu_item_name_response(ui, label, enabled, checked).clicked() +} + +/// [`menu_item_name`] that returns the row's response. +fn menu_item_name_response(ui: &mut Ui, label: &str, enabled: bool, checked: bool) -> egui::Response { let text = if checked { format!("✓ {label}") } else { format!(" {label}") }; - ui.add_enabled(enabled, egui::Button::new(egui::RichText::new(text).size(12.5)).frame_when_inactive(false)).clicked() + ui.add_enabled(enabled, egui::Button::new(egui::RichText::new(text).size(12.5)).frame_when_inactive(false)) } From a5cc1d65483beddd285dc44970ea4f645afd589c Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Thu, 19 Nov 2026 05:42:24 -0800 Subject: [PATCH 5/5] Symbols: a click egui counts reads its modifiers wherever the button goes up A click that went down on New Symbol, Delete Symbol or a panel menu item and went up in a later frame within egui's click distance reads the modifiers of that release, also past the interact radius. A click within one frame is matched by where the button went down, as egui does. --- crates/ui-egui/src/panels/symbols.rs | 50 ++++++++++++++++++++++------ 1 file changed, 40 insertions(+), 10 deletions(-) diff --git a/crates/ui-egui/src/panels/symbols.rs b/crates/ui-egui/src/panels/symbols.rs index 5557b7c8fe..894e10bb95 100644 --- a/crates/ui-egui/src/panels/symbols.rs +++ b/crates/ui-egui/src/panels/symbols.rs @@ -608,13 +608,13 @@ fn alt_at_release(ui: &Ui) -> bool { /// The modifiers held for a click on the widget whose interact rectangle is `rect`: when the /// primary button last went up in this frame as a click (the pointer stayed within egui's click -/// distance of where the button went down) over `rect` or within egui's interact radius of it -/// (egui counts a release that close as a click on the widget), as it went up (egui reports the -/// click of the last such release in the frame), else now, as for a click from the keyboard or a -/// screen reader. A release that ends a drag is not a click and is skipped, also when the drag -/// began in an earlier frame. `pointer` is whether egui reports the widget clicked by the primary -/// button; when it is false, the click came from the keyboard or a screen reader and the modifiers -/// held now are used. +/// distance of where the button went down) after going down over `rect` or within egui's interact +/// radius of it (egui gives a press that close to the widget), as it went up (egui reports the +/// click of the last such release in the frame); else, when no such click happened in this frame, +/// as the first release of the frame went up, which ends a press of an earlier frame that egui +/// counted as the click; else now. A release that ends a drag is not a click and is skipped. +/// `pointer` is whether egui reports the widget clicked by the primary button; when it is false, +/// the click came from the keyboard or a screen reader and the modifiers held now are used. fn modifiers_released_in(ui: &Ui, rect: egui::Rect, pointer: bool) -> egui::Modifiers { if !pointer { return ui.input(|i| i.modifiers); @@ -629,7 +629,7 @@ fn modifiers_released_in(ui: &Ui, rect: egui::Rect, pointer: bool) -> egui::Modi // Whether a button went down earlier in this frame; until one does, a release ends a press // of an earlier frame. let mut pressed_here = false; - // The modifiers of the release over `rect` that ends a press of an earlier frame. + // The modifiers of the release that ends a press of an earlier frame. let mut early = None; let mut found = None; for e in &i.events { @@ -644,10 +644,10 @@ fn modifiers_released_in(ui: &Ui, rect: egui::Rect, pointer: bool) -> egui::Modi } egui::Event::PointerButton { pos, button, pressed: false, modifiers } => { moved |= origin.is_some_and(|o| o.distance(*pos) > max_click_dist); - let over = rect.distance_sq_to_pos(*pos) <= radius * radius; + let over = origin.is_some_and(|o| rect.distance_sq_to_pos(o) <= radius * radius); if *button == egui::PointerButton::Primary { if !pressed_here { - early = over.then_some(*modifiers); + early = early.or(Some(*modifiers)); } else if !moved && over { found = Some(*modifiers); } @@ -1347,6 +1347,36 @@ mod tests { assert_eq!(art(&app, "New Symbol"), (0, 1), "Shift: the rectangle stays ordinary art"); } + /// A click that goes down on the edge of New Symbol and, in the next frame, up past egui's + /// interact radius but within its click distance counts as a click on it and reads Shift and Alt + /// as the button goes up, though they are let go later in the same frame. + #[test] + fn a_click_released_past_the_interact_radius_reads_the_modifiers_as_the_button_goes_up() { + let (mut app, _) = leaf_dot_and_rect(); + let ctx = egui::Context::default(); + ctx.enable_accesskit(); + let modifiers = egui::Modifiers::SHIFT | egui::Modifiers::ALT; + let out = frame_held(&ctx, &mut app, vec![], modifiers); + let nodes = &out.platform_output.accesskit_update.as_ref().expect("an accessibility tree").nodes; + let b = nodes + .iter() + .find(|(_, n)| n.label().is_some_and(|l| l.trim() == "New Symbol")) + .and_then(|(_, n)| n.bounds()) + .expect("a New Symbol button"); + let y = ((b.y0 + b.y1) / 2.0) as f32; + let (down, up) = (pos2(b.x0 as f32 + 0.5, y), pos2(b.x0 as f32 - 5.4, y)); + let radius = ctx.global_style().interaction.interact_radius; + let max_click_dist = ctx.options(|o| o.input_options.max_click_dist); + assert!(down.distance(up) <= max_click_dist && b.x0 as f32 - up.x > radius, "the release is a click outside the radius"); + let button = |at, pressed| egui::Event::PointerButton { pos: at, button: egui::PointerButton::Primary, pressed, modifiers }; + frame_held(&ctx, &mut app, vec![egui::Event::PointerMoved(down), button(down, true)], modifiers); + let events = vec![egui::Event::PointerMoved(up), button(up, false), egui::Event::ModifiersChanged(egui::Modifiers::NONE)]; + frame_held(&ctx, &mut app, events, modifiers); + assert_eq!(dialog_kind(&app), None, "Alt skips Symbol Options"); + assert_eq!(symbols(&mut app), ["Leaf", "Dot", "New Symbol"]); + assert_eq!(art(&app, "New Symbol"), (0, 1), "Shift: the rectangle stays ordinary art"); + } + /// An Alt-click on Delete Symbol followed in the same frame by a drag that ends just outside /// it without Alt reads Alt from the click: the release that ends the drag is not a click. #[test]