diff --git a/crates/ui-egui/src/dialogs_coupling_tests.rs b/crates/ui-egui/src/dialogs_coupling_tests.rs index f6c2f973a..b95f3bd35 100644 --- a/crates/ui-egui/src/dialogs_coupling_tests.rs +++ b/crates/ui-egui/src/dialogs_coupling_tests.rs @@ -54,8 +54,9 @@ fn picked_gear_faces_choose_their_joints_and_radii() { let mut app = discs(); app.start("joint.gear"); let mut d = app.dialog.take().unwrap(); - // G2 first, G1 second: the joints follow the picks, whatever the dialog started on. - for (i, p) in [Vec3::new(50.0, 0.0, 2.5), Vec3::new(10.0, 0.0, 2.5)].into_iter().enumerate() { + // G2 first, G1 second: the joints follow the picks, whatever the dialog started on. The + // discs touch at x = 10, on both walls, so G1 is picked on its far side. + for (i, p) in [Vec3::new(50.0, 0.0, 2.5), Vec3::new(-10.0, 0.0, 2.5)].into_iter().enumerate() { d.active = i; let pick = wall(&app, p); d.pick(&app.session, pick); diff --git a/crates/ui-egui/src/round_pick_tests.rs b/crates/ui-egui/src/round_pick_tests.rs index 00bb3efac..f48c62663 100644 --- a/crates/ui-egui/src/round_pick_tests.rs +++ b/crates/ui-egui/src/round_pick_tests.rs @@ -24,7 +24,9 @@ fn shaft() -> Harness { h } -/// The shaft's wall, top rim and top cap, as picks. +/// The shaft's wall, top rim and top cap, as picks. The rim is picked at the middle of its +/// polyline: its first point is the vertex where the wall's seam meets it, as near the seam as +/// the rim. fn picks(h: &Harness) -> (Sel, Sel, Sel) { use solidcraft_engine::kernel::{FaceSurface, face_surface}; let st = h.app.session.world_state().unwrap(); @@ -42,7 +44,7 @@ fn picks(h: &Harness) -> (Sel, Sel, Sel) { .enumerate() .find_map(|(index, e)| { let c = solidcraft_engine::kernel::edge_circle(&b.body, index)?; - (c.center.z > 9.0).then(|| Sel::Edge { body: "Shaft".into(), index, point: e[0] }) + (c.center.z > 9.0).then(|| Sel::Edge { body: "Shaft".into(), index, point: crate::viewport::polyline_mid(e) }) }) .unwrap(); (wall, rim, cap) diff --git a/crates/ui-egui/src/viewport.rs b/crates/ui-egui/src/viewport.rs index 29bce24f6..04acbc867 100644 --- a/crates/ui-egui/src/viewport.rs +++ b/crates/ui-egui/src/viewport.rs @@ -9473,7 +9473,8 @@ mod tests { fn cosmetic_threads_use_depth_tested_lines_and_keep_selection_and_wireframe() { let mut s = solidcraft_engine::Session::default(); s.execute("solid.cylinder", &json!({"radius":3,"height":10})).unwrap(); - s.execute("solid.thread", &json!({"face":[3,0,5],"designation":"M6","length":5})).unwrap(); + // A pick in the middle of a face free at both ends names the end the thread starts from. + s.execute("solid.thread", &json!({"face":[3,0,5],"designation":"M6","length":5,"from":[3,0,0]})).unwrap(); let mut app = SolveApp::new(s, crate::Services::default()); let count = |sc: GpuScene| { sc.merged()