Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion Scripts/Editor/NodeEditorGUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ private void OnGUI() {
DrawNodes();
DrawSelectionBox();
DrawTooltip();
DrawToolbar();
graphEditor.OnGUI();

// Run and reset onLateGUI
Expand Down Expand Up @@ -85,6 +86,28 @@ public void DrawGrid(Rect rect, float zoom, Vector2 panOffset) {
GUI.DrawTextureWithTexCoords(rect, gridTex, new Rect(tileOffset, tileAmount));
GUI.DrawTextureWithTexCoords(rect, crossTex, new Rect(tileOffset + new Vector2(0.5f, 0.5f), tileAmount));
}

private void DrawToolbar() {
GUILayout.BeginHorizontal(EditorStyles.toolbar);
{
GUILayout.Space(2);
GUILayout.Label(graph.name, EditorStyles.boldLabel);
GUILayout.Space(10);

// Draw scale bar
GUILayout.Label("Scale", EditorStyles.miniLabel);
var newZoom = GUILayout.HorizontalSlider(
zoom, 1f, 5f, GUILayout.MinWidth(40), GUILayout.MaxWidth(100)
);
GUILayout.Label(zoom.ToString("0.0#x"), EditorStyles.miniLabel, GUILayout.Width(30));
if (Math.Abs(newZoom - zoom) > Mathf.Epsilon) {
zoom = newZoom;
}

GUILayout.FlexibleSpace();
}
GUILayout.EndHorizontal();
}

public void DrawSelectionBox() {
if (currentActivity == NodeActivity.DragGrid) {
Expand Down Expand Up @@ -524,4 +547,4 @@ private void DrawTooltip() {
}
}
}
}
}