private void RemoveConnectionToDrawDrawable()
 {
     if (conToDraw != null)
     {
         editorBelongingTo.RemoveConnection(conToDraw);
         conToDraw = null;
     }
 }
Пример #2
0
 public void AddConnectionToDraw(ConnectionToDraw toDraw)
 {
     if (toDraw == null)
     {
         return;
     }
     connectionsToDraw.Add(toDraw);
 }
    public void DeleteNode()
    {
        if (GraphNode.HasParent)
        {
            GraphNode.UncoupleFromParent();
            editorBelongingTo.RemoveConnection(conToDraw);
            conToDraw = null;
        }

        if (GraphNode is ParentableNode)
        {
            var n = GraphNode as ParentableNode;

            //unset con to draw for all child nodes
            foreach (BaseFuncGraphNode node in n)
            {
                if (node != null)
                {
                    var editorNode = editorBelongingTo.GetNode(node);
                    editorNode.RemoveConnectionToDrawDrawable();
                }
            }

            //make sure to unset all children
            n.RemoveAllChildren();
        }

        //probably not necessary
        // but maybe avoid circular reference and no garbage collection
        for (int i = 0; i < connectionPoints.Count; i++)
        {
            connectionPoints[i].UnsetNodeBelongingTo();
        }
        //inform graph
        editorBelongingTo.RemoveNode(this);
        GraphNode = null;
    }
 private void CreateConnectionDrawable(FunctionGraphEditorNode to, ConnectionPoint fromPoint, ConnectionPoint toPoint)
 {
     conToDraw = new ConnectionToDraw(this, to, fromPoint, toPoint, to.connectionPoints.IndexOf(toPoint));
 }
Пример #5
0
 public void RemoveConnection(ConnectionToDraw conToDraw)
 {
     connectionsToDraw.Remove(conToDraw);
 }