Flood.GUI.Controls.DockBase.GetDroppedTabDirection C# (CSharp) Method

GetDroppedTabDirection() protected method

Calculates dock direction from dragdrop coordinates.
protected GetDroppedTabDirection ( int x, int y ) : Pos
x int X coordinate.
y int Y coordinate.
return Pos
        protected virtual Pos GetDroppedTabDirection(int x, int y)
        {
            int w = Width;
            int h = Height;
            float top = y / (float)h;
            float left = x / (float)w;
            float right = (w - x) / (float)w;
            float bottom = (h - y) / (float)h;
            float minimum = Math.Min(Math.Min(Math.Min(top, left), right), bottom);

            m_DropFar = (minimum < 0.2f);

            if (minimum > 0.3f)
                return Pos.Fill;

            if (top == minimum && (null == m_Top || m_Top.IsHidden))
                return Pos.Top;
            if (left == minimum && (null == m_Left || m_Left.IsHidden))
                return Pos.Left;
            if (right == minimum && (null == m_Right || m_Right.IsHidden))
                return Pos.Right;
            if (bottom == minimum && (null == m_Bottom || m_Bottom.IsHidden))
                return Pos.Bottom;

            return Pos.Fill;
        }