Merge pull request #10921 from dotCooCoo/fix/extend-path-e-outside-drag

Fix #10804: E with the Extend Path tool cycles its shape without a drag
This commit is contained in:
.CooCoo authored and GitHub committed 2026-12-05 05:00:56 -08:00
commit 00d97198b8
2 files changed
+28

No files matched your search

@@ -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);
+25
View File
@@ -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() {