From: Antonio Ospite Date: Tue, 26 Jun 2018 13:46:14 +0000 (+0200) Subject: svgwrite_diagram: proper support for stroke_width X-Git-Url: https://git.ao2.it/flexagon-toolkit.git/commitdiff_plain/2fde23a2e920ed2dab6dfd661077c251f28578db?ds=inline 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() --- 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)