summaryrefslogtreecommitdiff
path: root/lib/stitches
diff options
context:
space:
mode:
authorKaalleen <36401965+kaalleen@users.noreply.github.com>2022-06-10 16:31:11 +0200
committerGitHub <noreply@github.com>2022-06-10 16:31:11 +0200
commit6922f8ff7e12638048800b9525fa8c3077384c2d (patch)
tree28af7a3e3848465c9ec410ef8fee81805c6d5e19 /lib/stitches
parent2fde596272b339ebb9b63ceebd66c5e7a0c641f2 (diff)
autorun: keep attribs of original elements (#1682)
Diffstat (limited to 'lib/stitches')
-rw-r--r--lib/stitches/auto_run.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/stitches/auto_run.py b/lib/stitches/auto_run.py
index 4656bc5d..ab5762a3 100644
--- a/lib/stitches/auto_run.py
+++ b/lib/stitches/auto_run.py
@@ -202,6 +202,12 @@ def path_to_elements(graph, path, trim): # noqa: C901
element = graph[start][end].get('element')
start_coord = graph.nodes[start]['point']
end_coord = graph.nodes[end]['point']
+ # create a new element if we hit an other original element to keep it's properties
+ if el and element and el != element and d and not direction == 'underpath':
+ element_list.append(create_element(d, position, path_direction, el))
+ original_parents.append(el.node.getparent())
+ d = ""
+ position += 1
if element:
el = element
@@ -248,8 +254,6 @@ def create_element(path, position, direction, element):
if not path:
return
- style = inkex.Style(element.node.get("style"))
- style = style + inkex.Style("stroke-dasharray:0.5,0.5;fill:none;")
el_id = "%s_%s_" % (direction, position)
index = position + 1
@@ -262,7 +266,7 @@ def create_element(path, position, direction, element):
node.set("id", generate_unique_id(element.node, el_id))
node.set(INKSCAPE_LABEL, label)
node.set("d", path)
- node.set("style", str(style))
+ node.set("style", element.node.style)
# Set Ink/Stitch attributes
stitch_length = element.node.get(INKSTITCH_ATTRIBS['running_stitch_length_mm'], '')
@@ -280,6 +284,7 @@ def create_element(path, position, direction, element):
else:
if stitch_length:
node.set(INKSTITCH_ATTRIBS['running_stitch_length_mm'], stitch_length)
+ node.set("style", element.node.style + inkex.Style("stroke-dasharray:0.5,0.5;fill:none;"))
return Stroke(node)