From f4c0dc451d0cffaf67cee2e0b22fad9753059eea Mon Sep 17 00:00:00 2001 From: Hakan Seven Date: Thu, 8 Oct 2026 08:34:49 +0300 Subject: [PATCH] fix(linetype): arcs scale their dash elements with the pattern Circle and ellipse shaders scaled the pattern length by the linetype scale (PSLTSCALE in a viewport, annotation scale in model) but not the dash and gap elements, so a dashed arc broke into dots. Fixes #1644 Co-Authored-By: Claude Opus 5.5 --- src/shaders/circle.wgsl | 5 ++++- src/shaders/ellipse.wgsl | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/shaders/circle.wgsl b/src/shaders/circle.wgsl index e178340bf..ef6bbf99d 100644 --- a/src/shaders/circle.wgsl +++ b/src/shaders/circle.wgsl @@ -278,7 +278,10 @@ fn in_dash(dist: f32, pat_len: f32, p0: vec4, p1: vec4) -> bool { if in.pattern_length > 0.0 { let pat_len = in.pattern_length * u.linetype_scale; if in.min_elem * u.linetype_scale >= u.world_per_pixel && pat_len > 0.0 { - if !in_dash(arc_dist, pat_len, in.pat0, in.pat1) { + // The elements scale with the pattern length (PSLTSCALE, + // annotation scale), or the dashes fall out of step with it. + let lt = u.linetype_scale; + if !in_dash(arc_dist, pat_len, in.pat0 * lt, in.pat1 * lt) { discard; } } diff --git a/src/shaders/ellipse.wgsl b/src/shaders/ellipse.wgsl index 5fac0447c..2fbe20ab5 100644 --- a/src/shaders/ellipse.wgsl +++ b/src/shaders/ellipse.wgsl @@ -263,7 +263,10 @@ fn in_dash(dist: f32, pat_len: f32, p0: vec4, p1: vec4) -> bool { if in.pattern_length > 0.0 { let pat_len = in.pattern_length * u.linetype_scale; if in.min_elem * u.linetype_scale >= u.world_per_pixel && pat_len > 0.0 { - if !in_dash(arc_dist, pat_len, in.pat0, in.pat1) { + // The elements scale with the pattern length (PSLTSCALE, + // annotation scale), or the dashes fall out of step with it. + let lt = u.linetype_scale; + if !in_dash(arc_dist, pat_len, in.pat0 * lt, in.pat1 * lt) { discard; } }