fix(dimension): a dimension drawn live matches its baked block

Once edited, a dimension is drawn live instead of from its *D block;
on the #898 drawing that differed in three places:

- Oblique / architectural-tick strokes were DIMASZ/2 to each side, the
  block's are DIMASZ/sqrt(2) (its unit stroke runs corner to corner).
- Arrowheads and ticks shared the dimension line's wire, so a dashed
  dim line broke its ticks into stubs. They get their own solid wire
  (and explode as lines as before).
- A diameter's user-positioned text was lifted by the DIMTAD offset even
  when the stored point already was the text's middle, as a file saved
  elsewhere writes it; it is lifted only when it lies on the leader
  (#1323's case).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Hakan SevenandClaude Opus 5.5 committed 2026-10-01 00:27:42 +03:00
1 parent 59651052f8
commit 1f5a7e97a1
3 files changed
+84 -18

No files matched your search

+11 -3
View File
@@ -2529,9 +2529,13 @@ fn builtin_arrow_from_block_name(name: &str, dimasz: f32) -> Option<ArrowKind> {
Some(ArrowKind::Origin { size: dimasz })
}
// `ArrowKind::Tick` draws the stroke `size` to either side of the tip
// (total 2·size — its `size` is a half-length, matching DIMTSZ). For
// a block-selected tick DIMASZ is the full stroke length, so halve it.
"OBLIQUE" | "ARCHTICK" => Some(ArrowKind::Tick { size: dimasz * 0.5 }),
// (total 2·size — its `size` is a half-length, matching DIMTSZ). The
// block's stroke runs (-0.5,-0.5)→(0.5,0.5) scaled by DIMASZ, so its
// half-length is DIMASZ/√2, not DIMASZ/2 — halving drew every
// oblique stroke √2 short of the file's own. (#898)
"OBLIQUE" | "ARCHTICK" => Some(ArrowKind::Tick {
size: dimasz * std::f32::consts::FRAC_1_SQRT_2,
}),
"BOXFILLED" => Some(ArrowKind::Box_ {
size: dimasz,
filled: true,
@@ -2850,6 +2854,9 @@ fn append_custom_fill_points(
pub(crate) struct DimGeom {
pub(crate) ext_lines: Vec<[f32; 3]>,
pub(crate) dim_lines: Vec<[f32; 3]>,
/// Arrowhead / tick outlines of a dimension: drawn solid, never in the
/// dimension line's dashes.
pub(crate) arrow_lines: Vec<[f32; 3]>,
pub(crate) arrow_fill: Vec<[f32; 3]>,
}
@@ -2858,6 +2865,7 @@ impl DimGeom {
Self {
ext_lines: Vec::new(),
dim_lines: Vec::new(),
arrow_lines: Vec::new(),
arrow_fill: Vec::new(),
}
}