Skip to content

SolidCraft: an open-source parametric 3D CAD application built in pure Rust. Desktop, web, and automation through MCP.

Dragging a part along its joint no longer highlights what's under the pointer (#5137) (#5140)

raykholo755ad9af07f8
diff --git a/crates/ui-egui/src/joint_drag.rs b/crates/ui-egui/src/joint_drag.rs
index bea0d15fb3..f7de2b4988 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 d730cb72fa..1f6cd647f8 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));