Ejemplo n.º 1
0
        public override void CacheTransform()
        {
            base.CacheTransform();

            var ratio = cachedSize / targetSize;

            switch (strategy)
            {
            case Strategy.Minimum: content.scl.Set(Math.Min(ratio.x, ratio.y)); break;

            case Strategy.Maximum: content.scl.Set(Math.Max(ratio.x, ratio.y)); break;

            case Strategy.Average: content.scl.Set(.5f * (ratio.x + ratio.y)); break;

            case Strategy.Separate: content.scl = ratio; break;
            }
            content.size = cachedSize / content.scl;
            content.CacheTransform();
        }