Fixed the orientation issue with rendering sketch as svg.

The sketches were flipped vertically when displayed as svg. It was due to the
defaults in the drawSvg library that was using bottom-left corner as the
origin by default. Fixed it by specifying the top-right as the origin.
This commit is contained in:
Anand Chitipothu
2021-03-23 04:26:24 +00:00
parent 071df674c0
commit dfafab3ccd

View File

@@ -37,7 +37,7 @@ def _read_messages(ws):
return messages
def draw_image(commands):
img = draw.Drawing(300, 300, fill='none', stroke='black')
img = draw.Drawing(300, 300, origin=(0, -300), fill='none', stroke='black')
for c in commands:
if c['function'] == 'circle':
img.append(draw.Circle(cx=c['x'], cy=c['y'], r=c['d']/2))