forked from 1b-agent/opencadstudio-upstream
fix(leader): suppress oversized arrowheads, keep them precise at UTM
Three defects made a leader's arrowhead render as one stray line far longer than the leader itself, at UTM coordinates: - The arrowhead was drawn even when it is larger than the first leader segment it sits on. A DIMASZ sized for a bigger plot (here 6 units on a ~1-4 unit pointer) painted a stroke longer than the whole leader. AutoCAD omits the arrowhead when it does not fit the first segment, so gate the arrow on `arrow_size <= first_segment_len`. - Leader geometry was built as absolute f32. At UTM coordinates (Y ~ 4.5M, f32 ulp ~ 0.5) the oblique arrow tick's small cross-slope quantised away, collapsing the 45-degree tick into a flat horizontal line. Build the path and arrow in absolute f64 — the arrow around a local origin so append_arrow's f32 math stays precise — then RTE-split into the double single (points_low / fill_tris_low) at the end. - The `_Oblique` / `_Archtick` arrowhead block mapped to ArrowKind::Tick with the full DIMASZ, but the tick emitter draws `size` to either side (half-length semantics, matching DIMTSZ). Pass half so an oblique arrowhead sizes to DIMASZ like every other arrowhead, not double. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
ec92a0cdc6
commit
2d3f33de10
2 files changed
+48
-26
No files matched your search
@@ -1551,7 +1551,12 @@ fn arrow_from_block_name(name: Option<&str>, dimasz: f32) -> ArrowKind {
|
||||
"ORIGIN" | "ORIGIN2" | "ORIGININDICATOR" | "ORIGININDICATOR2" => {
|
||||
ArrowKind::Origin { size: dimasz }
|
||||
}
|
||||
"OBLIQUE" | "ARCHTICK" => ArrowKind::Tick { 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). As an
|
||||
// arrowhead block, though, DIMASZ is the stroke's *full* length like
|
||||
// every other arrowhead here, so pass half of it — otherwise the
|
||||
// oblique tick renders twice the intended DIMASZ.
|
||||
"OBLIQUE" | "ARCHTICK" => ArrowKind::Tick { size: dimasz * 0.5 },
|
||||
"BOXFILLED" => ArrowKind::Box_ {
|
||||
size: dimasz,
|
||||
filled: true,
|
||||
|
||||
Reference in new issue
Block a user