fix(plot): match PDF output to viewport

Refs #618
This commit is contained in:
Hakan Seven committed 2026-08-01 20:05:38 +03:00
1 parent 90a5495601
commit 6c62daf260
6 files changed
+142 -90

No files matched your search

+1 -8
View File
@@ -433,13 +433,6 @@ impl Scene {
let hatches = self.plot_hatches_for_block(model_block, Some(&frozen));
for hatch in hatches {
if matches!(&hatch.pattern, HatchPattern::Pattern(_)) {
// The GPU draws PAT zero-length dash entries as one-pixel
// dots. Convert that display pixel to model units before
// projecting so vector output keeps the same dot size
// instead of expanding it from the pattern period.
let dot_length = (25.4 / 96.0)
* self.paper_space_unit_factor()
/ viewport_scale.max(1e-9);
let mut points = Vec::new();
let mut aabb = [
f32::INFINITY,
@@ -447,7 +440,7 @@ impl Scene {
f32::NEG_INFINITY,
f32::NEG_INFINITY,
];
for [a, b] in hatch.pattern_segments_for_plot(dot_length) {
for [a, b] in hatch.pattern_segments_for_plot() {
let (Some(a), Some(b)) =
(project(a[0], a[1]), project(b[0], b[1]))
else {