CNCMaps.Engine.Map.Map.GetAutoSizePixels C# (CSharp) Method

GetAutoSizePixels() public method

public GetAutoSizePixels ( ) : Rectangle
return System.Drawing.Rectangle
        public Rectangle GetAutoSizePixels()
        {
            // uses full map, but if it's too close to localsize reverts to local
            var full = GetFullMapSizePixels();
            var local = GetLocalSizePixels();
            const double delta = 0.15;
            if (Math.Abs(full.Left - local.Left) / (double)full.Width < delta
                && Math.Abs(full.Width - local.Width) / (double)full.Width < delta
                && Math.Abs(full.Top - local.Top) / (double)full.Height < delta
                && Math.Abs(full.Bottom - local.Bottom) / (double)full.Height < delta)
                return local;
            else return full;
        }