Commit 0fa33b07 authored by Dan Pascu's avatar Dan Pascu

Fixed formula for 'negative' cropping (i.e. adding space around the icon)

parent e4e0c45c
......@@ -48,7 +48,11 @@ class Spinner(QSvgWidget):
def _update_viewbox(self, size):
if self._original_viewbox.isEmpty() or size.isEmpty():
return
viewbox = self._original_viewbox.adjusted(self.icon_crop, self.icon_crop, -self.icon_crop, -self.icon_crop)
if self.icon_crop >= 0:
adjustment = self.icon_crop
else:
adjustment = self._original_viewbox.width() * self.icon_crop / (self._original_viewbox.width() + 2*self.icon_crop) # (w - w * w/(w+2b))/2 = wb/(w+2b)
viewbox = self._original_viewbox.adjusted(adjustment, adjustment, -adjustment, -adjustment)
width = size.width()
height = size.height()
if height >= width:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment