fix(dimension): correct aligned/ordinate placement and preview plane (#150)

DIMALIGNED's drag preview never matched where the dimension landed. The
preview offset the dimension line in the XZ plane while the committed
entity's renderer offsets in the XY plane, and the commit path passed the
straight-line p2→cursor *distance* to `set_offset`, which re-applies it
along the perpendicular — wrong distance, always on the +perp side. Both
now store the cursor as the definition point and project it onto the
XY-plane perpendicular, matching the renderer and DIMLINEAR.

The same XZ-vs-XY plane confusion affected other annotate commands:

- DIMORDINATE worked entirely in the XZ plane (dropping the Y coordinate)
  and left `definition_point` at the origin, so the leader kinked through
  (0,0,0). Reworked onto the XY plane with a proper orthogonal elbow and a
  live preview that matches the placed entity.
- DIMTEDIT / DIMJOGLINE cursor markers were built in the XZ plane, so in
  the top-down view they collapsed to a flat line instead of a box /
  zigzag. Rebuilt in the XY plane.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Hakan SevenandClaude Opus 4.8 committed 2026-06-25 17:55:39 +03:00
1 parent fcb97b12da
commit 9d5bed2727
4 files changed
+99 -34

No files matched your search

+8 -5
View File
@@ -99,12 +99,15 @@ impl CadCommand for DimTeditCommand {
let d = 0.2_f32;
Some(WireModel {
name: "dimtedit_preview".into(),
// Marker box in the XY drawing plane (Z is elevation, ~0). The old
// box varied Z, so in the top-down view it collapsed to a flat line
// instead of a square. (#150)
points: vec![
[pt.x - d, pt.y, pt.z - d],
[pt.x + d, pt.y, pt.z - d],
[pt.x + d, pt.y, pt.z + d],
[pt.x - d, pt.y, pt.z + d],
[pt.x - d, pt.y, pt.z - d],
[pt.x - d, pt.y - d, pt.z],
[pt.x + d, pt.y - d, pt.z],
[pt.x + d, pt.y + d, pt.z],
[pt.x - d, pt.y + d, pt.z],
[pt.x - d, pt.y - d, pt.z],
],
points_low: Vec::new(),
color: WireModel::CYAN,