fix error related feeding str to polyline2pathd

pull/116/head
Andy Port 2020-07-06 17:33:24 -07:00
parent 12c8d07bad
commit 1a4807e929
1 changed files with 5 additions and 1 deletions

View File

@ -50,7 +50,11 @@ def ellipse2pathd(ellipse):
def polyline2pathd(polyline, is_polygon=False): def polyline2pathd(polyline, is_polygon=False):
"""converts the string from a polyline points-attribute to a string for a """converts the string from a polyline points-attribute to a string for a
Path object d-attribute""" Path object d-attribute"""
points = COORD_PAIR_TMPLT.findall(polyline.get('points', '')) if isinstance(polyline, str):
points = polyline
else:
points = COORD_PAIR_TMPLT.findall(polyline.get('points', ''))
closed = (float(points[0][0]) == float(points[-1][0]) and closed = (float(points[0][0]) == float(points[-1][0]) and
float(points[0][1]) == float(points[-1][1])) float(points[0][1]) == float(points[-1][1]))