rect.maxRectUniformScaleToFit(limitRectangle [, origin])

Returns a number that specifies the maximum scaling that can be applied to rect along both axes so that it would still fit into limitRectangle. If origin is specified, rect is scaled around it; otherwise, rect is scaled around its center.