commit d9771212bc4e965cb39b31ed13ff85a377e7f95e parent 883fe7469df36d9deed5c8b5471beb2b3f4bf5e7 Author: Yuval Langer <yuvallangerontheroad@gmail.com> Date: Mon, 1 Jun 2020 21:36:10 +0300 Move the move command to the SVG file content template. Diffstat:
M | dabbling/dragon_curve.py | | | 4 | ++-- |
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dabbling/dragon_curve.py b/dabbling/dragon_curve.py @@ -51,11 +51,11 @@ def path_to_svg_file_content( path = [(image_width * p[0] / max_x, image_height * p[1] / max_y) for p in path] - svg_path = f'M{path[0][0]} {path[0][1]}' + ''.join(f'L{p[0]} {p[1]} ' for p in path).strip() + svg_path = ''.join(f'L{p[0]} {p[1]}' for p in path).strip() return f''' <svg width="{image_width}" height="{image_height}" xmlns="http://www.w3.org/2000/svg"> - <path fill="none" stroke="black" stroke-linejoin="round" stroke-width="0.7" d="{svg_path}"/> + <path fill="none" stroke="black" stroke-linejoin="round" stroke-width="0.7" d="M{path[0][0]} {path[0][1]}{svg_path}"/> </svg> '''.strip()