From cf2a44ef8e4ff53d6649a3c5dccb35c283dc7ab2 Mon Sep 17 00:00:00 2001
From: Kaalleen <36401965+kaalleen@users.noreply.github.com>
Date: Sat, 7 Dec 2024 15:12:37 +0100
Subject: use non-accumulative command scaling (#3329)
---
lib/extensions/commands_scale_symbols.py | 11 ++++++-----
lib/gui/request_update_svg_version.py | 2 +-
templates/commands_scale_symbols.xml | 2 +-
3 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/lib/extensions/commands_scale_symbols.py b/lib/extensions/commands_scale_symbols.py
index 4fa272e3..0e5f482a 100644
--- a/lib/extensions/commands_scale_symbols.py
+++ b/lib/extensions/commands_scale_symbols.py
@@ -11,18 +11,19 @@ from .base import InkstitchExtension
class CommandsScaleSymbols(InkstitchExtension):
def __init__(self, *args, **kwargs):
InkstitchExtension.__init__(self, *args, **kwargs)
- self.arg_parser.add_argument("-s", "--size", dest="size", type=float, default=1)
+ self.arg_parser.add_argument("-s", "--size", dest="size", type=int, default=100)
def effect(self):
- size = self.options.size
+ size = self.options.size / 100
+ # scale symbols
svg = self.document.getroot()
command_symbols = svg.xpath(".//svg:symbol[starts-with(@id,'inkstitch_')]", namespaces=NSS)
for symbol in command_symbols:
- transform = Transform(symbol.get('transform')).add_scale(size)
+ transform = Transform(f'scale({size})')
symbol.set('transform', str(transform))
+ # scale markers
markers = svg.xpath(".//svg:marker[starts-with(@id, 'inkstitch')]", namespaces=NSS)
for marker in markers:
- marker_size = float(marker.get('markerWidth', 0.5)) * size
- marker.set('markerWidth', marker_size)
+ marker.set('markerWidth', str(size / 2))
diff --git a/lib/gui/request_update_svg_version.py b/lib/gui/request_update_svg_version.py
index 4373a36b..b9dd24ec 100644
--- a/lib/gui/request_update_svg_version.py
+++ b/lib/gui/request_update_svg_version.py
@@ -72,7 +72,7 @@ class RequestUpdate:
app = wx.App()
frame = RequestUpdateFrame(
- title=_("Ink/Stitch"),
+ title="Ink/Stitch",
on_cancel=self.cancel_update,
)
frame.Show()
diff --git a/templates/commands_scale_symbols.xml b/templates/commands_scale_symbols.xml
index b9600f34..09bcd439 100644
--- a/templates/commands_scale_symbols.xml
+++ b/templates/commands_scale_symbols.xml
@@ -3,7 +3,7 @@
Scale Command Symbols
org.{{ id_inkstitch }}.commands_scale_symbols
commands_scale_symbols
- 1.0
+ 100
all
{{ icon_path }}inx/commands_scale.svg
--
cgit v1.2.3