From 49d1e2e31cea3c3729d38049707b86291b17c506 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Thu, 5 Nov 2026 17:32:30 -0500 Subject: [PATCH] pick select: a Prototype-tab press clears the pick like any canvas press A press on a connection handle or noodle returns from the canvas input before the ordinary press reset, so the pick (and keyboard box) stayed up. Clear them on that press too. Co-Authored-By: Claude Fable 5.1 --- crates/ui-egui/src/canvas/input.rs | 10 ++++++++++ crates/ui-egui/src/layers_keyboard_tests.rs | 19 +++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/crates/ui-egui/src/canvas/input.rs b/crates/ui-egui/src/canvas/input.rs index dc5647376..1f0f4a557 100644 --- a/crates/ui-egui/src/canvas/input.rs +++ b/crates/ui-egui/src/canvas/input.rs @@ -140,6 +140,14 @@ fn import_dropped(app: &mut FigApp, ctx: &egui::Context, hover_pos: Option boo if crate::proto_canvas::input(app, ui, resp) { // A prototype gesture is a press on the canvas too: the Pages list gives up the keyboard. app.ui.pages_focus = None; + // And it ends the keyboard selection box and pick select, as any canvas press does. + end_keyboard_box(app, ui.ctx()); return true; } let ctx = ui.ctx().clone(); diff --git a/crates/ui-egui/src/layers_keyboard_tests.rs b/crates/ui-egui/src/layers_keyboard_tests.rs index 871aeff02..6fd06bba7 100644 --- a/crates/ui-egui/src/layers_keyboard_tests.rs +++ b/crates/ui-egui/src/layers_keyboard_tests.rs @@ -311,3 +311,22 @@ fn tab_switches_the_selection_box_to_pick_select() { assert!(u.app.session.selection().is_empty(), "nothing selected in the new document"); assert!(u.app.ui.pick.is_none()); } + +/// A press on a prototype connection handle is a press on the canvas too: it ends pick select +/// like any other canvas press, rather than leaving the pink outline up. +#[test] +fn a_prototype_handle_press_ends_pick_select() { + let (mut u, a, _) = setup(); + u.app.run("select.set", json!({"ids": [a]})); + press(&mut u, Key::F8, Modifiers::NONE); + press(&mut u, Key::Tab, Modifiers::NONE); + assert_eq!(u.app.picked(), Some(a)); + u.app.ui.right_tab = crate::RightTab::Prototype; + u.frame(vec![]); + assert_eq!(u.app.picked(), Some(a), "still picking in the Prototype tab"); + let b = u.app.session.doc().unwrap().world_bounds(a).unwrap(); + let handle = u.app.to_screen(b.x1, (b.y0 + b.y1) / 2.0) + egui::vec2(11.0, 0.0); + u.button(handle, true); + u.button(handle, false); + assert!(u.app.ui.pick.is_none(), "the handle press ends pick select"); +}