Example #1
0
        protected void setModfCursor(PointF pt, int handle, bool active, bool autoh)
        {
            Node node          = null;
            bool checkHandleId = false;

            if (active && fc.ActiveObject.getType() != ItemType.Arrow)
            {
                node          = fc.ActiveObject as Node;
                checkHandleId = true;
            }

            if (!checkHandleId &&
                autoh && fc.getAutoHObj().getType() != ItemType.Arrow)
            {
                node          = fc.getAutoHObj() as Node;
                checkHandleId = true;
            }

            if (checkHandleId && handle != 8)
            {
                if (handle == 9)
                {
                    currentCursor = fc.CurRotateShape;
                }
                else if (node != null && node.rotation() != 0)
                {
                    float a = 0, r = 0;
                    float d = 360 / 16;
                    MindFusion.Geometry.Geometry2D.Convert.DekartToPolar(
                        node.getCenter(), pt, ref a, ref r);
                    a = (int)(360 - a) % 360;
                    if (a >= 1 * d && a < 3 * d)
                    {
                        currentCursor = fc.CurMainDgnlResize;
                    }
                    else
                    if (a >= 3 * d && a < 5 * d)
                    {
                        currentCursor = fc.CurVertResize;
                    }
                    else
                    if (a >= 5 * d && a < 7 * d)
                    {
                        currentCursor = fc.CurSecDgnlResize;
                    }
                    else
                    if (a >= 7 * d && a < 9 * d)
                    {
                        currentCursor = fc.CurHorzResize;
                    }
                    else
                    if (a >= 9 * d && a < 11 * d)
                    {
                        currentCursor = fc.CurMainDgnlResize;
                    }
                    else
                    if (a >= 11 * d && a < 13 * d)
                    {
                        currentCursor = fc.CurVertResize;
                    }
                    else
                    if (a >= 13 * d && a < 15 * d)
                    {
                        currentCursor = fc.CurSecDgnlResize;
                    }
                    else
                    {
                        currentCursor = fc.CurHorzResize;
                    }
                }
                else
                {
                    if (handle == 0 || handle == 2)
                    {
                        currentCursor = fc.CurMainDgnlResize;
                    }
                    if (handle == 1 || handle == 3)
                    {
                        currentCursor = fc.CurSecDgnlResize;
                    }
                    if (handle == 4 || handle == 6)
                    {
                        currentCursor = fc.CurVertResize;
                    }
                    if (handle == 5 || handle == 7)
                    {
                        currentCursor = fc.CurHorzResize;
                    }
                }
            }
            else
            {
                currentCursor = fc.CurModify;
            }

            fc.Cursor = currentCursor;
        }