From dfafab3ccdd804cd1eda6a4ec753bc4ea5127643 Mon Sep 17 00:00:00 2001 From: Anand Chitipothu Date: Tue, 23 Mar 2021 04:26:24 +0000 Subject: [PATCH] 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. --- community/lms/doctype/lms_sketch/livecode.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/community/lms/doctype/lms_sketch/livecode.py b/community/lms/doctype/lms_sketch/livecode.py index 4363efc7..0069252d 100644 --- a/community/lms/doctype/lms_sketch/livecode.py +++ b/community/lms/doctype/lms_sketch/livecode.py @@ -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))