package ru.m.puzzlez.render;

import flash.geom.Rectangle;

class RenderUtil {
    public static function containRectangle(source:Rectangle, target:Rectangle):Rectangle {
        var s = Math.min(1, Math.min(target.width / source.width, target.height / source.height));
        var width = source.width * s;
        var height = source.height * s;
        return new Rectangle((target.width - width) / 2, (target.height - height) / 2, width, height);
    }
}
