rect.maxRectScaleToFit(limitRectangle [, origin])

Returns an object where sx and sy give the maximum scaling that can be applied to rect so that it would still fit into limitRectangle. If origin is specified, rect is scaled around it; otherwise, rect is scaled around its center.