Size the Design move/rotate gizmo from the body, like Orca's Prepare gizmos

The Design gizmo already had both move arrows and rotation rings, but drew them
at a fixed 70 px arm regardless of the body: on a 40 mm cube everything
collapsed into a ~100 px tangle buried inside the solid, so the rings were
effectively invisible and the tool read as "move only, no rotate".

Orca's Prepare gizmos size themselves from the selection's bounding sphere
(GLGizmoRotate3D: m_radius = Offset + sphere radius) so the handles always clear
the object. Same rule here: DesignPanel passes the body's bounding-sphere radius
(scale-aware) into the gizmo, and move_gizmo_arm() returns
max(70 px, 1.25 * radius) — the screen-space floor keeps it grabbable on a tiny
body or when zoomed far out. Ring radius and BOTH hit-tests derive from that one
helper, so picking cannot drift from what is drawn.

Verified on a 40 mm cube: rings now encircle the body, arrow drag moves with a
live mm readout, ring drag rotates live.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BVzKmX6Y1aEteit1HTXG4Q
This commit is contained in:
Tommaso Bianchi
2026-07-19 08:36:26 +02:00
co-authored by Claude Opus 4.8
parent f4160595b0
commit 8d529ad413
5 changed files with 39 additions and 11 deletions
+3 -2
View File
@@ -512,9 +512,10 @@ ColorRGBA DesignCanvas::body_color(int body) const
return body_palette(body);
}
void DesignCanvas::begin_move_body(int body, const Vec3d& pivot, const Transform3d& base_xform)
void DesignCanvas::begin_move_body(int body, const Vec3d& pivot, const Transform3d& base_xform,
double body_radius)
{
m_sketch_tool.set_move_gizmo(body, pivot, base_xform);
m_sketch_tool.set_move_gizmo(body, pivot, base_xform, body_radius);
request_repaint();
}