From b0d858df2bc31dca934688f46aac22c71678d902 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Tue, 24 Jun 2025 09:18:22 +0200 Subject: [PATCH] :bug: Fix wasm problem with horizontal/vertical lines --- render-wasm/src/shapes/modifiers.rs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/render-wasm/src/shapes/modifiers.rs b/render-wasm/src/shapes/modifiers.rs index 28a25dcc0a..b3b1998fa4 100644 --- a/render-wasm/src/shapes/modifiers.rs +++ b/render-wasm/src/shapes/modifiers.rs @@ -115,8 +115,19 @@ fn set_pixel_precision(transform: &mut Matrix, bounds: &mut Bounds) { let x = bounds.min_x().round(); let y = bounds.min_y().round(); - let scale_width = f32::max(0.01, bounds.width().round() / bounds.width()); - let scale_height = f32::max(0.01, bounds.height().round() / bounds.height()); + let width = bounds.width(); + let height = bounds.height(); + + let scale_width = if width > 0.1 { + f32::max(0.01, bounds.width().round() / bounds.width()) + } else { + 1.0 + }; + let scale_height = if height > 0.1 { + f32::max(0.01, bounds.height().round() / bounds.height()) + } else { + 1.0 + }; if f32::is_finite(scale_width) && f32::is_finite(scale_height)