bugfix epilog bbox adjist

This commit is contained in:
leyghisbb 2021-05-07 22:51:41 +02:00
parent 0758fbface
commit 2d7939d6d8

View File

@ -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