From 755ad9af07f86ebe10383266b3bdb7020a5b514e Mon Sep 17 00:00:00 2001 From: raykholo Date: Fri, 23 Oct 2026 14:45:45 +0000 Subject: [PATCH] Dragging a part along its joint no longer highlights what's under the pointer (#5137) (#5140) * claim: #5137 * Dragging a part along its joint no longer highlights what's under the pointer (#5137) The viewport's hover pick was skipped during a box selection and camera moves, but not while a jointed part was dragged, so faces and edges under the pointer lit up on every frame of the drag. The pick now waits until the joint drag ends. --- crates/ui-egui/src/joint_drag.rs | 18 ++++++++++++++++++ crates/ui-egui/src/viewport.rs | 6 +++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/crates/ui-egui/src/joint_drag.rs b/crates/ui-egui/src/joint_drag.rs index bea0d15fb..f7de2b498 100644 --- a/crates/ui-egui/src/joint_drag.rs +++ b/crates/ui-egui/src/joint_drag.rs @@ -187,6 +187,24 @@ mod tests { assert!(arm_at(&h, end).dist(end) < 1e-9, "{:?}", arm_at(&h, end)); } + /// #5137: while a part is dragged along its joint, nothing under the pointer highlights; hover + /// comes back once the drag ends. + #[test] + fn dragging_a_jointed_part_highlights_nothing_under_the_pointer() { + let (mut h, _, a, b) = hinged_arm(); + h.app.synthetic.push(egui::Event::PointerMoved(a)); + play(&mut h); + assert!(h.app.viewport.hover.is_some(), "the arm under the pointer must highlight before the drag"); + press_and_move(&mut h, a, b); + assert!(h.app.viewport.joint_drag.is_some(), "the drag must move the arm"); + assert!(h.app.viewport.hover.is_none(), "dragging a part must not highlight what is under the pointer"); + h.frames(2); + assert!(h.app.viewport.hover.is_none(), "a drag held still must not highlight either"); + release(&mut h, b); + h.frames(2); + assert!(h.app.viewport.hover.is_some(), "hover must return after the drag"); + } + /// With the undo history full, a drag still adds one step: it drops the oldest once, not one /// per frame. #[test] diff --git a/crates/ui-egui/src/viewport.rs b/crates/ui-egui/src/viewport.rs index d730cb72f..1f6cd647f 100644 --- a/crates/ui-egui/src/viewport.rs +++ b/crates/ui-egui/src/viewport.rs @@ -2874,7 +2874,11 @@ pub fn show(app: &mut SolveApp, ui: &mut egui::Ui) { || app.viewport.axis_drag.is_some() || app.viewport.spin || app.cam_anim.is_some(); - let hits = hover.filter(|_| inside && app.viewport.boxsel.is_none() && !navigating).map(|p| pick_cached(app, &proj, p)).unwrap_or_default(); + // A part dragged along its joint owns the pointer: nothing under it lights up (#5137). + let hits = hover + .filter(|_| inside && app.viewport.boxsel.is_none() && !crate::joint_drag::active(app) && !navigating) + .map(|p| pick_cached(app, &proj, p)) + .unwrap_or_default(); // The Fillet and Chamfer window resolves its own corners: the nearest sketch point to a // corner drawn from the origin is the fixed origin, which ends no two curves. let corner = hover.filter(|_| inside && !navigating).and_then(|p| crate::sketch_modify_ui::corner_hit(app, &proj, p));