summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaalleen <36401965+kaalleen@users.noreply.github.com>2024-05-20 16:02:09 +0200
committerGitHub <noreply@github.com>2024-05-20 16:02:09 +0200
commitadb6f008afae56d2216dfc547ea4ae48dee35bd2 (patch)
tree4925cb81da834aae4169c1198383cdb2f6fc5989
parent9a0e2de21a956d20c8b561f868462dbcd13aa1f0 (diff)
tartan: fix non tartan group selection (#2922)
-rw-r--r--lib/extensions/tartan.py9
-rw-r--r--lib/tartan/svg.py3
2 files changed, 10 insertions, 2 deletions
diff --git a/lib/extensions/tartan.py b/lib/extensions/tartan.py
index 7f8c582a..8c3c8c5f 100644
--- a/lib/extensions/tartan.py
+++ b/lib/extensions/tartan.py
@@ -32,8 +32,15 @@ class Tartan(InkstitchExtension):
def _get_elements(self):
for node in self.svg.selection:
+ self.get_selection(node)
+
+ def get_selection(self, node):
+ if node.TAG == 'g' and not node.get_id().startswith('inkstitch-tartan'):
+ for child_node in node.iterchildren():
+ self.get_selection(child_node)
+ else:
node = self.get_outline(node)
- if node.style('fill'):
+ if node.tag in EMBROIDERABLE_TAGS and node.style('fill'):
self.elements.add(node)
def get_outline(self, node):
diff --git a/lib/tartan/svg.py b/lib/tartan/svg.py
index 4ca48f02..739315cf 100644
--- a/lib/tartan/svg.py
+++ b/lib/tartan/svg.py
@@ -77,7 +77,8 @@ class TartanSvgGroup:
else:
group = Group()
group.set('id', f'inkstitch-tartan-{int(time.time())}')
- parent_group.append(group)
+ index = parent_group.index(outline)
+ parent_group.insert(index, group)
outline_shape = FillStitch(outline).shape
transform = get_correction_transform(outline)