(self, x0, y0, x1, y1)
return x0, y0, x1, y1
Constrain the viewbox ratio.
Constrain the viewbox ratio.
Constrain the viewbox ratio .
def constrain_viewbox(self, x0, y0, x1, y1):
        """Constrain the viewbox ratio."""
        if (x1-x0) > (y1-y0):
            d = ((x1-x0)-(y1-y0))/2
            y0 -= d
            y1 += d
        else:
            d = ((y1-y0)-(x1-x0))/2
            x0 -= d
            x1 += d
        return x0, y0, x1, y1
def constrain_viewbox ( self , x0 , y0 , x1 , y1 ) : if ( x1 - x0 ) > ( y1 - y0 ) : d = ( ( x1 - x0 ) - ( y1 - y0 ) ) / 2 y0 -= d y1 += d else : d = ( ( y1 - y0 ) - ( x1 - x0 ) ) / 2 x0 -= d x1 += d return x0 , y0 , x1 , y1