From 2fde23a2e920ed2dab6dfd661077c251f28578db Mon Sep 17 00:00:00 2001 From: Antonio Ospite Date: Tue, 26 Jun 2018 15:46:14 +0200 Subject: [PATCH 1/1] svgwrite_diagram: proper support for stroke_width Support stroke_width for all drawing operations that call the _stroke() method, and remove ad-hoc support for draw_polygon_by_verts() and draw_star_by_verts() --- src/diagram/svgwrite_diagram.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/diagram/svgwrite_diagram.py b/src/diagram/svgwrite_diagram.py index b9e5a56..1da39a2 100755 --- a/src/diagram/svgwrite_diagram.py +++ b/src/diagram/svgwrite_diagram.py @@ -118,13 +118,14 @@ class SvgwriteDiagram(Diagram): element['stroke'] = stroke_color element['stroke-opacity'] = a element['stroke-linejoin'] = 'round' + element['stroke-width'] = self.stroke_width else: element['stroke'] = 'none' def draw_polygon_by_verts(self, verts, stroke_color=(0, 0, 0), fill_color=None): - polygon = self.svg.polygon(verts, stroke_width=self.stroke_width) + polygon = self.svg.polygon(verts) self._fill(polygon, fill_color) self._stroke(polygon, stroke_color) @@ -133,7 +134,7 @@ class SvgwriteDiagram(Diagram): def draw_star_by_verts(self, cx, cy, verts, stroke_color=(0, 0, 0)): for v in verts: - line = self.svg.line((cx, cy), v, stroke_width=self.stroke_width) + line = self.svg.line((cx, cy), v) self._stroke(line, stroke_color) self.add(line) -- 2.1.4