예제 #1
0
        public override bool HitTest(int x, int y)
        {
            if (GraphicsUtil.Distance(TopLeftCorner, (float)x, (float)y) < View.ViewFactory.EdgeBoxWidth / 2)
            {
                this.SelectedPoint = TopLeftCorner;
                this.MouseState    = Entities.MouseState.Resize;
                return(true);
            }
            if (GraphicsUtil.Distance(BottomRightCorner, (float)x, (float)y) < View.ViewFactory.EdgeBoxWidth / 2)
            {
                this.SelectedPoint = BottomRightCorner;
                this.MouseState    = Entities.MouseState.Resize;
                return(true);
            }

            if (HasPoint(x, y))
            {
                LastHitPoint.X     = x;
                LastHitPoint.Y     = y;
                this.SelectedPoint = LastHitPoint;
                this.MouseState    = Entities.MouseState.Move;
                return(true);
            }
            return(false);
        }
예제 #2
0
 public override bool HitTest(int x, int y)
 {
     if (GraphicsUtil.Distance(StartPoint, (float)x, (float)y) < View.ViewFactory.EdgeBoxWidth / 2)
     {
         this.SelectedPoint = StartPoint;
         this.MouseState    = Entities.MouseState.Resize;
         return(true);
     }
     if (GraphicsUtil.Distance(EndPoint, (float)x, (float)y) < View.ViewFactory.EdgeBoxWidth / 2)
     {
         this.SelectedPoint = EndPoint;
         this.MouseState    = Entities.MouseState.Resize;
         return(true);
     }
     return(false);
 }
예제 #3
0
 public override bool HitTest(int x, int y)
 {
     if (GraphicsUtil.Distance(ControlPoint1, (float)x, (float)y) < View.ViewFactory.EdgeBoxWidth / 2)
     {
         this.SelectedPoint = ControlPoint1;
         this.MouseState    = Entities.MouseState.Resize;
         return(true);
     }
     if (GraphicsUtil.Distance(ControlPoint2, (float)x, (float)y) < View.ViewFactory.EdgeBoxWidth / 2)
     {
         this.SelectedPoint = ControlPoint2;
         this.MouseState    = Entities.MouseState.Resize;
         return(true);
     }
     if (base.HitTest(x, y))
     {
         return(true);
     }
     else
     {
         if (GraphicsUtil.HasPoint(new FlowChartPoint[] { StartPoint, ControlPoint1, ControlPoint2, EndPoint }, x, y) ||
             GraphicsUtil.HasPoint(new FlowChartPoint[] { StartPoint, ControlPoint1, EndPoint, ControlPoint2 }, x, y))
         {
             for (int i = 0; i < this.points.Count; i++)
             {
                 if (GraphicsUtil.Distance(x, y, this.points[i].X, this.points[i].Y) < View.ViewFactory.EdgeBoxWidth / 2)
                 {
                     this.MouseState     = Entities.MouseState.Move;
                     this.LastHitPoint.X = x;
                     this.LastHitPoint.Y = y;
                     this.SelectedPoint  = this.LastHitPoint;
                     return(true);
                 }
             }
         }
         return(false);
     }
 }
예제 #4
0
 void LinePointMoved(BaseBoxComponent cmp)
 {
     foreach (FlowChartPoint edgePoint in cmp.EdgePoints)
     {
         float d = GraphicsUtil.Distance(edgePoint, linePoint);
         cmp.IsSelected = (d < cmp.View.ViewFactory.EdgeBoxWidth * 5);
         if (d < cmp.View.ViewFactory.EdgeBoxWidth * 2)
         {
             linePoint.X = edgePoint.X;
             linePoint.Y = edgePoint.Y;
             if (lineCmp.StartPoint == linePoint)
             {
                 lineCmp.ConnectionStart           = cmp;
                 lineCmp.ConnectionStartPointIndex = cmp.EdgePoints.IndexOf(edgePoint);
             }
             else if (lineCmp.EndPoint == linePoint)
             {
                 lineCmp.ConnectionEnd           = cmp;
                 lineCmp.ConnectionEndPointIndex = cmp.EdgePoints.IndexOf(edgePoint);
             }
             return;
         }
     }
 }