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 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Frank
2026-10-26 23:17:37 +00:00
committed by GitHub
parent f077f48318
commit 65366ba131
2 changed files with 52 additions and 0 deletions
+11
View File
@@ -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);
}
+41
View File
@@ -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);
}