From 93614ab554f3952101c6d41073fe66bf9de011b5 Mon Sep 17 00:00:00 2001 From: Hakan Seven Date: Fri, 1 May 2026 21:13:56 +0300 Subject: [PATCH] fix: apply global LTSCALE to linetype pattern rendering Entity linetype_scale is a per-entity multiplier applied on top of the document-level $LTSCALE header variable. The previous code used only the entity scale (defaulting to 1.0), ignoring $LTSCALE entirely. Drawings with a non-default LTSCALE showed dash patterns at the wrong size. Effective scale is now: document.header.linetype_scale * entity linetype_scale. Applied in both render::render_style_for and the complex-linetype path in tessellate_entity. Fixes part of #10 Co-Authored-By: Claude Sonnet 4.6 --- src/scene/mod.rs | 2 +- src/scene/render.rs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/scene/mod.rs b/src/scene/mod.rs index 1fc10ccb1..5df8a6f27 100644 --- a/src/scene/mod.rs +++ b/src/scene/mod.rs @@ -3115,7 +3115,7 @@ fn tessellate_entity( let (entity_color, pattern_length, pattern, line_weight_px, aci) = render::render_style_for(document, e); let entity_color = render::adapt_to_bg(entity_color, bg_color); - let lt_scale = e.common().linetype_scale as f32; + let lt_scale = document.header.linetype_scale as f32 * e.common().linetype_scale as f32; let lt_name = render::linetype_name_for(document, e); if let EntityType::Dimension(dim) = e { diff --git a/src/scene/render.rs b/src/scene/render.rs index 6948962f3..bd09f066c 100644 --- a/src/scene/render.rs +++ b/src/scene/render.rs @@ -213,7 +213,8 @@ pub(super) fn render_style_for( }; let lt_name = linetype_name_for(document, e); - let lt_scale = e.common().linetype_scale as f32; + // Effective scale = global LTSCALE × per-entity scale (both default to 1.0). + let lt_scale = document.header.linetype_scale as f32 * e.common().linetype_scale as f32; let (pattern_length, pattern) = resolve_pattern(&document.line_types, lt_name, lt_scale); let line_weight_px = {