fix buxtronix hinges to work with paths correctly (wrong scaling)

This commit is contained in:
Mario Voigt 2021-12-29 23:46:41 +01:00
parent 5034f80090
commit b869e17401

View File

@ -437,9 +437,16 @@ class BuxtronixLivingHinges(inkex.EffectExtension):
if self.options.swatch or not self.svg.selected:
draw_one(0, 0)
else:
unit_factor = 1.0 / self.svg.uutounit(1.0,self.options.unit)
scale_factor = self.svg.unittouu("1px")
for elem in self.svg.selected.values():
# Determine width and height based on the selected object's bounding box.
bbox = elem.bounding_box()
if isinstance (elem, inkex.Rectangle) or \
isinstance (elem, inkex.Circle) or \
isinstance (elem, inkex.Ellipse):
bbox = elem.bounding_box()
else:
bbox = elem.bounding_box() * (unit_factor / scale_factor)
self.options.width = self.svg.unittouu(bbox.width)
self.options.height = self.svg.unittouu(bbox.height)
x = self.svg.unittouu(bbox.x.minimum)