forked from 1b-agent/opencadstudio-upstream
fix(render): improve dashed linetype rendering
This commit is contained in:
1 parent
513ab958a8
commit
a2d4caf2f0
3 files changed
+12
-3
No files matched your search
@@ -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 {
|
||||||
|
|||||||
@@ -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,
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user