From 65366ba13179c96e044a4a7a3ad5d3d414c618a1 Mon Sep 17 00:00:00 2001 From: Frank <58932224+plexi32@users.noreply.github.com> Date: Mon, 26 Oct 2026 23:17:37 +0000 Subject: [PATCH] Move: after picking a body, go on to From, Point or Axis (#6170) (#6171) * claim: #6170 * Move: after picking a body, go on to From, Point or Axis (#6170) In Point to Point, Point to Position and Rotate, once a body is picked and the next input is empty, the dialog goes on to it, so the next click picks the point or axis instead of toggling another body. Free Move stays on Bodies: its Pivot is optional. Co-Authored-By: Claude Opus 5.5 --------- Co-authored-by: Claude Opus 5.5 --- crates/ui-egui/src/dialogs.rs | 11 +++++++ crates/ui-egui/src/dialogs_move_tests.rs | 41 ++++++++++++++++++++++++ 2 files changed, 52 insertions(+) diff --git a/crates/ui-egui/src/dialogs.rs b/crates/ui-egui/src/dialogs.rs index c9c1a5312..97d790342 100644 --- a/crates/ui-egui/src/dialogs.rs +++ b/crates/ui-egui/src/dialogs.rs @@ -1472,6 +1472,17 @@ impl Dialog { if !inp.multi && !inp.items.is_empty() && self.active + 1 < self.inputs.len() { self.advance(); } + // Move by points or about an axis: once a body is in, go on to the empty From, Point or + // Axis (#6170), so the next click picks it instead of another body. Free Move's Pivot is + // optional and stays unvisited. + if let Kind::Move { mode: crate::dialogs_move::ROTATE | crate::dialogs_move::POINT_TO_POINT | crate::dialogs_move::POINT_TO_POSITION, .. } = + self.kind + && self.active == 0 + && self.inputs.first().is_some_and(|i| !i.items.is_empty()) + && self.inputs.get(1).is_some_and(|i| i.items.is_empty()) + { + self.active = 1; + } self.error = None; self.sync_thread(s); } diff --git a/crates/ui-egui/src/dialogs_move_tests.rs b/crates/ui-egui/src/dialogs_move_tests.rs index 042bb7621..5dcd45b13 100644 --- a/crates/ui-egui/src/dialogs_move_tests.rs +++ b/crates/ui-egui/src/dialogs_move_tests.rs @@ -373,3 +373,44 @@ fn inch_move_lengths_agree_in_the_triad_and_every_numeric_move_route() { } } } + +/// After a body is picked, Point to Point, Point to Position and Rotate go on to their empty +/// From, Point or Axis, so the next click picks that instead of another body (#6170). Free +/// Move stays on Bodies: its Pivot is optional. +#[test] +fn a_body_pick_goes_on_to_the_point_or_axis() { + for (mode, next) in [(POINT_TO_POINT, Some(1)), (POINT_TO_POSITION, Some(1)), (ROTATE, Some(1)), (FREE, None)] { + let mut h = crate::scenario::Harness::new(); + h.app.home.open = false; + h.app.run("solid.box", json!({"length": 60, "width": 40, "height": 10})).unwrap(); + h.app.run("select.clear", json!({})).unwrap(); + h.app.cam.distance = 160.0; + h.settle(); + h.app.start("solid.move"); + let d = h.app.dialog.as_mut().unwrap(); + d.kind = kind(mode, &h.app.session.doc); + d.inputs = inputs(mode); + d.active = 0; + h.step(&json!({ "click": { "world": [30, 20, 10] } })).unwrap(); + let d = h.app.dialog.as_ref().unwrap(); + assert_eq!(d.inputs[0].items, vec![Sel::Body { name: "Body1".into() }], "{}", TYPES[mode]); + assert_eq!(d.active, next.unwrap_or(0), "{} goes on after the body", TYPES[mode]); + } + // Point to Point: the click after the body is the From point, the body stays picked. + let mut h = crate::scenario::Harness::new(); + h.app.home.open = false; + h.app.run("solid.box", json!({"length": 60, "width": 40, "height": 10})).unwrap(); + h.app.run("select.clear", json!({})).unwrap(); + h.app.cam.distance = 160.0; + h.settle(); + h.app.start("solid.move"); + let d = h.app.dialog.as_mut().unwrap(); + d.kind = kind(POINT_TO_POINT, &h.app.session.doc); + d.inputs = inputs(POINT_TO_POINT); + d.active = 0; + h.step(&json!({ "click": { "world": [30, 30, 10] } })).unwrap(); + h.step(&json!({ "click": { "world": [60, 0, 10] } })).unwrap(); + let d = h.app.dialog.as_ref().unwrap(); + assert_eq!(d.inputs[0].items.len(), 1, "the body is still picked"); + assert!(matches!(d.inputs[1].items.as_slice(), [Sel::Vertex { .. }]), "{:?}", d.inputs[1].items); +}