예제 #1
0
 public SelectionRectangle(DrawableObject _obj, ResizingTypes _clip, Point _point, bool _focus)
 {
     point = _point;
     obj   = _obj;
     clip  = _clip;
     focus = _focus;
 }
예제 #2
0
        public Cursor Moving(Point position, Matrix transform)
        {
            foreach (SelectionRectangle sre in SelectionRectangles)
            {
                if (sre.Rectangle(transform.Elements.First()).Contains(position))
                {
                    CursorType   = CursorTypes.Resize;
                    ResizingType = sre.clip;
                    if (sre.obj is State || sre.obj is SuperState)
                    {
                        OnObject = sre.obj;
                    }
                    else if (sre.obj is Transition)
                    {
                        OnTransition = (Transition)sre.obj;
                        if (sre.clip == ResizingTypes.Spline0 && OnTransition.StartObject != null)
                        {
                            OnObject = OnTransition.StartObject;
                        }
                        else if (sre.clip == ResizingTypes.Spline3 && OnTransition.EndObject != null)
                        {
                            OnObject = OnTransition.EndObject;
                        }
                    }
                    switch (sre.clip)
                    {
                    case ResizingTypes.Left_Top:
                    case ResizingTypes.Right_Bottom:
                        return(Cursors.SizeNWSE);

                    case ResizingTypes.Left_Bottom:
                    case ResizingTypes.Right_Top:
                    case ResizingTypes.Spline0:
                    case ResizingTypes.Spline1:
                    case ResizingTypes.Spline2:
                    case ResizingTypes.Spline3:
                        return(Cursors.SizeNESW);

                    case ResizingTypes.Left:
                    case ResizingTypes.Right:
                        return(Cursors.SizeWE);

                    case ResizingTypes.Top:
                    case ResizingTypes.Bottom:
                        return(Cursors.SizeNS);
                    }
                }
            }
            foreach (DrawableObject obj in SelectedObjects)
            {
                if (obj.IsSelectablePoint(position))
                {
                    CursorType = CursorTypes.Move;
                    return(Cursors.SizeAll);
                }
            }
            CursorType = CursorTypes.Default;
            return(Cursors.Default);
        }