public AttachPoint Attach(AttachDirection direction, ConnectionViewModel connection, NodeBaseViewModel associatedControl)
        {
            AttachPoint attachPoint = new AttachPoint(direction, connection, associatedControl);

            attachPoint.DirectionChanging += attachPoint_DirectionChanging;
            AttachPoints[direction].Add(attachPoint);
            UpdateAttachPoints();
            return(attachPoint);
        }
Exemplo n.º 2
0
 public void SetAttachTo(Control ctrl, AttachDirection direction)
 {
     if (direction == AttachDirection.Right)
     {
         this.setRight(ctrl);
     }
     else if (direction == AttachDirection.Left)
     {
         this.setLeft(ctrl);
     }
 }
 Point GetPoint(AttachDirection dir, Rect rec)
 {
     if (dir == AttachDirection.Top)
     {
         return(new Point(rec.X + rec.Width / 2, rec.Y));
     }
     if (dir == AttachDirection.Right)
     {
         return(new Point(rec.X + rec.Width, rec.Y + rec.Height / 2));
     }
     if (dir == AttachDirection.Bottom)
     {
         return(new Point(rec.X + rec.Width / 2, rec.Y + rec.Height));
     }
     if (dir == AttachDirection.Left)
     {
         return(new Point(rec.X, rec.Y + rec.Height / 2));
     }
     throw new ArgumentException();
 }
Exemplo n.º 4
0
 public AttachPoint Attach(AttachDirection direction, ConnectionViewModel connection, NodeBaseViewModel node)
 {
     return(AttachPlacement.Attach(direction, connection, node));
 }
 void attachPoint_DirectionChanging(AttachPoint ap, AttachDirection direction)
 {
     AttachPoints[ap.Side].Remove(ap);
     AttachPoints[direction].Add(ap);
     //UpdatePoints();
 }
Exemplo n.º 6
0
 public AttachPoint(AttachDirection direction, ConnectionViewModel connection, NodeBaseViewModel associatedControl)
 {
     Side            = direction;
     this.Connection = connection;
     this.Control    = associatedControl;
 }
Exemplo n.º 7
0
 public AttachSides(AttachDirection fromSide, AttachDirection toSide)
 {
     FromSide = fromSide;
     ToSide   = toSide;
 }
Exemplo n.º 8
0
        public static Point GetAttachmentLocationOld(NodeBaseViewModel control, Point fromPoint, AttachDirection pos)
        {
            switch (pos)
            {
            case AttachDirection.Top:
                return(new Point(fromPoint.X - control.Size.Width / 2, fromPoint.Y - control.Size.Height));

            case AttachDirection.Right:
                return(new Point(fromPoint.X, fromPoint.Y - (control.Size.Height / 2)));

            case AttachDirection.Bottom:
                return(new Point(fromPoint.X - control.Size.Width / 2, fromPoint.Y));

            case AttachDirection.Left:
                return(new Point(fromPoint.X - control.Size.Width, fromPoint.Y - control.Size.Height / 2));

            default:
                throw new ArgumentException();
            }
        }