private void OnGUI() { _buffer.OnUpdate(Graph); _eventProcessor.Process(Graph); DrawGraph(); if (_eventProcessor.MultiSelectionOn) { TinyGUI.DrawMultiSelectionRect(_eventProcessor.StartPosition, _eventProcessor.CurrentPosition); } if (_eventProcessor.NewEdge) { TinyGUI.DrawEdge(_eventProcessor.StartPosition, _eventProcessor.CurrentPosition, true); } if (GUI.changed) { Repaint(); } }
private void DrawGraph(bool selected) { if (Graph == null) { return; } foreach (var node in Graph.Nodes.Where(x => selected == Selector.IsSelected(x))) { TinyGUI.DrawNode(node, selected, Graph.HasInEdge(node), Graph.HasOutEdge(node)); } foreach (var edge in Graph.Edges.Where(x => selected == Selector.IsSelected(x))) { var @out = TinyGUI.GetOutRect(Graph.GetNode(edge.Out)); var @in = TinyGUI.GetInRect(Graph.GetNode(edge.In)); if (TinyGUI.DrawEdge(@out, @in, selected)) { Selector.AddSingle(edge); } } }