void OnGUI() { Initialize(); var width = position.width; var height = position.height; _zoomArea = new Rect(0, 0, width, height); HandleEvents(); if (_graphGUI != null) { Rect r = EditorZoomArea.Begin(_zoom, _zoomArea); // Main graph area _graphGUI.BeginGraphGUI(this, r); _graphGUI.OnGraphGUI(); _graphGUI.EndGraphGUI(); // Clear selection on background click var e = Event.current; if (e.type == EventType.MouseDown && e.clickCount == 1) { _graphGUI.ClearSelection(); } EditorZoomArea.End(); } // Status bar GUILayout.BeginArea(new Rect(0, 0, width, kBarHeight + 5)); int result = GUILayout.Toolbar(-1, toolbarStrings); if (result == 0) { RebuildGraphOnSelected(true); } else if (result == 1) { RebuildGraphOnSelected(false); } else if (result == 2) { RefreshGraphConnections(); } GUILayout.EndArea(); const float maxWidth = 200; GUILayout.BeginArea(new Rect(0, kBarHeight + 5, maxWidth, 20 * 5), GUI.skin.box); showOnlyWhenSelected.Set(EditorGUILayout.Toggle("Show only when selected", showOnlyWhenSelected.Get(), GUILayout.MaxWidth(maxWidth))); showLabels.Set(EditorGUILayout.Toggle("Labels", showLabels.Get(), GUILayout.MaxWidth(maxWidth))); showComponentName.Set(EditorGUILayout.Toggle("Function Full Path", showComponentName.Get(), GUILayout.MaxWidth(maxWidth))); eventFullName.Set(EditorGUILayout.Toggle("Event Full Name", eventFullName.Get(), GUILayout.MaxWidth(maxWidth))); showTimesExecuted.Set(EditorGUILayout.Toggle("Times Executed", showTimesExecuted.Get(), GUILayout.MaxWidth(maxWidth))); GUILayout.EndArea(); }
void OnGUI() { var width = position.width; var height = position.height; _zoomArea = new Rect(0, 0, width, height); HandleEvents(); if (_graphGUI != null) { Rect r = EditorZoomArea.Begin(_zoom, _zoomArea); // Main graph area _graphGUI.BeginGraphGUI(this, r); _graphGUI.OnGraphGUI(); _graphGUI.EndGraphGUI(); // Clear selection on background click var e = Event.current; if (e.type == EventType.MouseDown && e.clickCount == 1) { _graphGUI.ClearSelection(); } EditorZoomArea.End(); } // Status bar GUILayout.BeginArea(new Rect(0, 0, width, kBarHeight + 5)); string[] toolbarStrings = new string[] { "Update connections", "Clear" }; int result = GUILayout.Toolbar(-1, toolbarStrings); if (result == 0) { RefreshGraphConnections(); } else if (result == 1) { RebuildGraph(); } GUILayout.EndArea(); }