Example #1
0
 public static Rect ScaleToFitInside(this Rect r, Rect bounds)
 {
     Vector2 dimensions = new Vector2(r.width, r.height);
     Vector2 constraints = new Vector2(bounds.width, bounds.height);
     Vector2 constrained = dimensions.ScaleToFitInside(constraints);
     return new Rect(r.x, r.y, constrained.x, constrained.y);
 }