From 6922f8ff7e12638048800b9525fa8c3077384c2d Mon Sep 17 00:00:00 2001 From: Kaalleen <36401965+kaalleen@users.noreply.github.com> Date: Fri, 10 Jun 2022 16:31:11 +0200 Subject: [PATCH] autorun: keep attribs of original elements (#1682) --- lib/stitches/auto_run.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/stitches/auto_run.py b/lib/stitches/auto_run.py index 4656bc5dc..ab5762a35 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)