fix(render): improve dashed linetype rendering

This commit is contained in:
gianlucafiore committed 2026-08-27 13:51:05 -03:00
1 parent 513ab958a8
commit a2d4caf2f0
3 files changed
+12 -3

No files matched your search

+2
View File
@@ -1535,6 +1535,8 @@ pub fn tessellate(
| EntityType::Circle(_) | EntityType::Circle(_)
| EntityType::Arc(_) | EntityType::Arc(_)
| EntityType::Ellipse(_) | EntityType::Ellipse(_)
| EntityType::Spline(_)
| EntityType::LwPolyline(_)
) { ) {
(pattern_length, pattern) (pattern_length, pattern)
} else { } else {
+1 -1
View File
@@ -250,7 +250,7 @@ impl Scene {
let source_length = stationed.then(|| wire.pattern_stations[wire.points.len()]); let source_length = stationed.then(|| wire.pattern_stations[wire.points.len()]);
let (clipped, mut clipped_stations) = clip_polyline_to_rect( let (clipped, mut clipped_stations) = clip_polyline_to_rect(
&projected_pts, &projected_pts,
stationed.then_some(&wire.pattern_stations[..wire.points.len()]), stationed.then(|| &wire.pattern_stations[..wire.points.len()]),
vp_x0, vp_x0,
vp_y0, vp_y0,
vp_x1, vp_x1,
+9 -2
View File
@@ -3795,14 +3795,21 @@ impl Scene {
full_bounds, full_bounds,
self.document.header.lineweight_display || display_plot_lineweights, self.document.header.lineweight_display || display_plot_lineweights,
); );
if self.document.header.paper_space_linetype_scaling
// Model space: scale linetypes using the current annotation scale so their
// appearance can match a paper-space viewport at the same drawing scale.
if self.current_layout == "Model" {
if self.annotation_scale.is_finite() && self.annotation_scale > 1e-9 {
uniforms.linetype_scale = self.annotation_scale;
}
} else if self.document.header.paper_space_linetype_scaling
&& !inst.paper_sheet && !inst.paper_sheet
&& inst.tile_idx.is_none()
&& inst.handle != Handle::NULL && inst.handle != Handle::NULL
{ {
if let Some(EntityType::Viewport(vp)) = self.document.get_entity(inst.handle) { if let Some(EntityType::Viewport(vp)) = self.document.get_entity(inst.handle) {
let viewport_scale = let viewport_scale =
vp_effective_scale(vp.custom_scale, vp.view_height, vp.height); vp_effective_scale(vp.custom_scale, vp.view_height, vp.height);
if viewport_scale.is_finite() && viewport_scale > 1e-9 { if viewport_scale.is_finite() && viewport_scale > 1e-9 {
uniforms.linetype_scale = (1.0 / viewport_scale) as f32; uniforms.linetype_scale = (1.0 / viewport_scale) as f32;
} }