summaryrefslogtreecommitdiff
path: root/lib/extensions/commands_scale_symbols.py
diff options
context:
space:
mode:
authorKaalleen <36401965+kaalleen@users.noreply.github.com>2024-12-07 15:12:37 +0100
committerGitHub <noreply@github.com>2024-12-07 15:12:37 +0100
commitcf2a44ef8e4ff53d6649a3c5dccb35c283dc7ab2 (patch)
tree2db4e6f3eb952a9c428fbd55a9d0321ca29913c0 /lib/extensions/commands_scale_symbols.py
parent1e86d621e6b3661bd250b56a2012dd59017edde6 (diff)
use non-accumulative command scaling (#3329)
Diffstat (limited to 'lib/extensions/commands_scale_symbols.py')
-rw-r--r--lib/extensions/commands_scale_symbols.py11
1 files changed, 6 insertions, 5 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))