private void imDrawSpace_MouseUp(object sender, MouseEventArgs e) { if (nodesEdgesState == NodesEdges.Nodes) { switch (clickState) { case ClickStates.Add: clickedNode = graph.AddNode(x, y, Color.White); break; case ClickStates.Delete: if (clickedNode != null) { graph.DeleteNode(clickedNode); } break; case ClickStates.Move: break; } } else { switch (clickState) { case ClickStates.Add: if (selectedNode != null && selectedNode != clickedNode) { IEdge edge = graph.AddEdge(clickedNode, selectedNode, DefaultLength); } break; case ClickStates.Delete: graph.DeleteEdge(clickedEdge); break; } } clickedNode = null; clickedEdge = null; clickState = ClickStates.NoClick; draw(); }
public void AddNode_ShouldSaveNodeInfo() { var node = graph.AddNode(0, 0, Color.Black); graph.NodeInfos[node] .Should() .Be(new NodeInfo(0, 0, Color.Black)); }