ME3Explorer.DialogEditor.DialogVis.UpdateEdge C# (CSharp) Method

UpdateEdge() public static method

public static UpdateEdge ( UMD.HCIL.Piccolo.Nodes.PPath edge ) : void
edge UMD.HCIL.Piccolo.Nodes.PPath
return void
        public static void UpdateEdge(PPath edge)
        {
            // Note that the node's "FullBounds" must be used (instead of just the "Bound") 
            // because the nodes have non-identity transforms which must be included when
            // determining their position.

            ArrayList nodes = (ArrayList)edge.Tag;
            PNode node1 = (PNode)nodes[0];
            PNode node2 = (PNode)nodes[1];
            PointF start = node1.GlobalBounds.Location;
            PointF end = node2.GlobalBounds.Location;
            float h1x, h1y, h2x, h2y;

            start.X += node1.GlobalBounds.Width * 0.5f;
            start.Y += node1.GlobalBounds.Height;
            h1x = h2x = 0;
            h1y = h2y = end.Y > start.Y ? 200 * (float)Math.Log10((end.Y - start.Y) / 200 + 1) : 200 * (float)Math.Log10((start.Y - end.Y) / 100 + 1);
            end.X += node2.GlobalBounds.Width / 2;
            //end.Y += node2.GlobalBounds.Height / 2;

            edge.Reset();
            //edge.AddLine(start.X, start.Y, end.X, end.Y);
            edge.AddBezier(start.X, start.Y, start.X + h1x, start.Y + h1y, end.X - h2x, end.Y - h2y, end.X, end.Y);
        }

Usage Example

示例#1
0
 protected override void OnDrag(object sender, PInputEventArgs e)
 {
     if (!e.Handled)
     {
         base.OnDrag(sender, e);
         foreach (PNode node in e.PickedNode.AllNodes)
         {
             ArrayList edges = (ArrayList)node.Tag;
             if (edges != null)
             {
                 foreach (PPath edge in edges)
                 {
                     DialogVis.UpdateEdge(edge);
                 }
             }
         }
     }
 }