From ecec18e70ce3abf656eacbfcab5a9bd7ff9d4f0f Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Fri, 4 Dec 2026 23:47:31 -0800 Subject: [PATCH] Fix #10804: E with the Extend Path tool cycles its shape without a drag The Extend Path tool claims E at all times, but outside a gesture the canvas takes only the fixed key sets its claims match (brackets, digits, Tab, Home and End). A plain E with no drag running went to the shortcuts and chose the Free Transform tool. The canvas now takes E while the active tool claims it, so E cycles the tool's shape (straight, bezier, arc) whether or not a drag is running, as docs/mcp.md describes. Other tools do not claim E outside a marquee, so E still chooses Free Transform with them. Reported by MichelRickhaus. --- crates/ui-egui/src/canvas/tool_adapter.rs | 3 +++ crates/ui-egui/src/shortcuts/tests.rs | 25 +++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/crates/ui-egui/src/canvas/tool_adapter.rs b/crates/ui-egui/src/canvas/tool_adapter.rs index c7d13cc96c..1e144c0f87 100644 --- a/crates/ui-egui/src/canvas/tool_adapter.rs +++ b/crates/ui-egui/src/canvas/tool_adapter.rs @@ -47,6 +47,7 @@ const PLANES: &[Chord] = &[Chord::plain(Key::Num1), Chord::plain(Key::Num2), Chord::plain(Key::Num3), Chord::plain(Key::Num4), Chord::plain(Key::Num5)]; const TAB: &[Chord] = &[Chord::plain(Key::Tab)]; const HOME_END: &[Chord] = &[Chord::plain(Key::Home), Chord::plain(Key::End)]; +const LETTER_E: &[Chord] = &[Chord::plain(Key::E)]; /// The modifiers of an egui key event, as the engine's tools read them. pub fn mods(m: egui::Modifiers, space: bool) -> Mods { @@ -489,6 +490,8 @@ impl CanvasTool for SessionTool<'_> { _ if claim(&mut app, EngineKey::Digit(1)) => PLANES, _ if claim(&mut app, EngineKey::Tab) => TAB, _ if claim(&mut app, EngineKey::Home) => HOME_END, + // The Extend Path tool's E cycles its shape with no drag running too. + _ if claim(&mut app, EngineKey::Letter('e')) => LETTER_E, _ => &[], }; let mut claims = ToolClaims::NONE.keys(keys); diff --git a/crates/ui-egui/src/shortcuts/tests.rs b/crates/ui-egui/src/shortcuts/tests.rs index 5ed8517c01..d2e2c1182c 100644 --- a/crates/ui-egui/src/shortcuts/tests.rs +++ b/crates/ui-egui/src/shortcuts/tests.rs @@ -406,6 +406,31 @@ fn tool_keys_choose_their_tools() { } } +/// E with the Extend Path tool and no drag cycles the tool's shape; with another tool E still chooses Free Transform. +#[test] +fn e_with_the_extend_path_tool_cycles_its_shape_without_a_drag() { + let press_e = |tool: &str| { + let mut app = new_app(); + let ctx = ready(&mut app); + app.select_tool(tool); + focus_canvas(&mut app, &ctx); + assert!(!app.session.tool_busy()); + key_frame(&mut app, &ctx, typed(Key::E, Modifiers::NONE, "e")); + app + }; + let app = press_e("selection"); + assert_eq!(app.session.tool_id(), "freeTransform", "E's shortcut with a tool that does not use E"); + + let extend = vectorcraft_tools::addons::extend_path::ID; + let mut app = press_e(extend); + assert_eq!(app.session.tool_id(), extend, "E is the tool's key"); + assert_eq!(app.session.tool_options()["mode"], "bezier", "E cycles straight to bezier"); + let ctx = ready(&mut app); + focus_canvas(&mut app, &ctx); + key_frame(&mut app, &ctx, typed(Key::E, Modifiers::NONE, "e")); + assert_eq!(app.session.tool_options()["mode"], "arc", "a second E cycles on"); +} + /// A tool bound to a key that types nothing, a panel and a command, and a held Cmd+= zooms on. #[test] fn shortcuts_run_tools_panels_and_commands() {