summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorKaalleen <36401965+kaalleen@users.noreply.github.com>2024-07-09 17:43:22 +0200
committerGitHub <noreply@github.com>2024-07-09 17:43:22 +0200
commitf55571eac13a32ec6d27a4d4c0929d47449da2d4 (patch)
treeed10422e75ff4109d288419d9e54c06e0cc9bc34 /lib
parent988bc27868ea4d2be7df09b8c439bda266b22a94 (diff)
png: use viewport unit to take svg scale value into account (#3073)
Diffstat (limited to 'lib')
-rw-r--r--lib/extensions/stitch_plan_preview.py7
1 files changed, 2 insertions, 5 deletions
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: