From f55571eac13a32ec6d27a4d4c0929d47449da2d4 Mon Sep 17 00:00:00 2001 From: Kaalleen <36401965+kaalleen@users.noreply.github.com> Date: Tue, 9 Jul 2024 17:43:22 +0200 Subject: png: use viewport unit to take svg scale value into account (#3073) --- lib/extensions/stitch_plan_preview.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'lib/extensions/stitch_plan_preview.py') diff --git a/lib/extensions/stitch_plan_preview.py b/lib/extensions/stitch_plan_preview.py index 8f76a447..ddb0e3d1 100644 --- a/lib/extensions/stitch_plan_preview.py +++ b/lib/extensions/stitch_plan_preview.py @@ -138,11 +138,8 @@ class StitchPlanPreview(InkstitchExtension): # Extract numbers from returned string. It can include other information such as warnings about the usage of AppImages out = findall(r"(?m)^-?\d+\.?\d*$", out) - # The query commands return positions in px, so we need to convert to uu. - px_to_uu = svg.unittouu("1px") - - # Parse the returned coordinates out. - x, y, width, height = map(lambda x: px_to_uu*float(x), out) + # Parse the returned coordinates out into viewport units + x, y, width, height = map(lambda x: svg.viewport_to_unit(f'{x}px', svg.unit), out) # Embed the rasterized stitch plan into the SVG, and replace the original stitch plan with open(temp_png_path, "rb") as f: -- cgit v1.2.3