forked from 1b-agent/opencadstudio-upstream
fix(linetype): route placeholder-complex linetypes to the dash path
A linetype element can carry a `complex` record with no renderable content (shape #0, null style handle, zero scale) — some DWGs store plain dash elements that way (e.g. ISO03W100 "ISO dash space"). document_complex_lt treated any `complex.is_some()` as complex and sent the entity down the CPU apply_along path, which skips the GPU dash shader and its A-type endpoint alignment. Gate on *renderable* content (non-empty text, or a shape with a real shape-file handle) so these fall through to resolve_pattern and dash on the GPU with proper A-type alignment. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
3e34da4ac6
commit
743dc1026d
1 file changed
+14
-1
+14
-1
@@ -153,7 +153,20 @@ pub fn document_complex_lt(document: &CadDocument, name: &str) -> Option<Complex
|
|||||||
.line_types
|
.line_types
|
||||||
.iter()
|
.iter()
|
||||||
.find(|l| l.name.eq_ignore_ascii_case(name))?;
|
.find(|l| l.name.eq_ignore_ascii_case(name))?;
|
||||||
if !lt.elements.iter().any(|e| e.complex.is_some()) {
|
// Treat the linetype as complex only when an element carries *renderable*
|
||||||
|
// embedded content — a non-empty text string, or a shape backed by a shape
|
||||||
|
// file. Some DWGs store dash elements with a placeholder `complex` (shape
|
||||||
|
// #0, null style handle, zero scale) that draws nothing; routing those
|
||||||
|
// through the CPU complex-linetype path needlessly skips the normal dash
|
||||||
|
// shader — and with it the "A"-type endpoint alignment. Fall through to the
|
||||||
|
// ordinary `resolve_pattern` path for them.
|
||||||
|
let has_real_complex = lt.elements.iter().any(|e| {
|
||||||
|
e.complex.as_ref().is_some_and(|cx| match &cx.content {
|
||||||
|
LineTypeComplexContent::Text { text } => !text.trim().is_empty(),
|
||||||
|
LineTypeComplexContent::Shape { .. } => !cx.style_handle.is_null(),
|
||||||
|
})
|
||||||
|
});
|
||||||
|
if !has_real_complex {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
document_lt_segments(document, name)
|
document_lt_segments(document, name)
|
||||||
|
|||||||
Reference in new issue
Block a user