From 2d7939d6d8ac4e40c44032b15540fc3058ef83d3 Mon Sep 17 00:00:00 2001 From: leyghisbb Date: Fri, 7 May 2021 22:51:41 +0200 Subject: [PATCH] bugfix epilog bbox adjist --- extensions/fablabchemnitz/epilog_bbox_adjust.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/extensions/fablabchemnitz/epilog_bbox_adjust.py b/extensions/fablabchemnitz/epilog_bbox_adjust.py index 2f10a55d..54046e7d 100644 --- a/extensions/fablabchemnitz/epilog_bbox_adjust.py +++ b/extensions/fablabchemnitz/epilog_bbox_adjust.py @@ -29,8 +29,9 @@ class BBoxAdjust(inkex.EffectExtension): bbox += element.bounding_box() # adjust the viewBox to the bbox size and add the desired offset - self.document.getroot().attrib['viewBox'] = f'{-offset} {-offset} {bbox.width + offset * 2} {bbox.height + offset * 2}' + # note from 07.05.2021: seems if the following order is viewBox/width/height, or width/height/viewBox, the units are not respected. So me mess around a little bit self.document.getroot().attrib['width'] = f'{bbox.width + offset * 2}' + self.svg.unit + self.document.getroot().attrib['viewBox'] = f'{-offset} {-offset} {bbox.width + offset * 2} {bbox.height + offset * 2}' self.document.getroot().attrib['height'] = f'{bbox.height + offset * 2}' + self.svg.unit # translate all elements to fit the adjusted viewBox