From d6ae3bedcef1b2b8f894fc1e1c68e92b0f38bc5a Mon Sep 17 00:00:00 2001 From: Adsito Date: Fri, 14 Jun 2019 14:55:28 +1000 Subject: [PATCH] Zoom System Fixes - Due to the OnGUI method being called last to draw over everything else in the window, the GUI.Group being created in the new zoom system was also moving around the GUI elements created in the NodeGraphEditor OnGUI method. --- Scripts/Editor/NodeEditorGUI.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Scripts/Editor/NodeEditorGUI.cs b/Scripts/Editor/NodeEditorGUI.cs index aa88505..2a581a2 100644 --- a/Scripts/Editor/NodeEditorGUI.cs +++ b/Scripts/Editor/NodeEditorGUI.cs @@ -30,7 +30,7 @@ namespace XNodeEditor { DrawNodes(); DrawSelectionBox(); DrawTooltip(); - graphEditor.OnGUI(); + DrawOnGUI(); // Run and reset onLateGUI if (onLateGUI != null) { @@ -443,5 +443,15 @@ namespace XNodeEditor { Repaint(); } } + + private void DrawOnGUI() // Ends the GUI Group temporarily to draw any additional elements in the NodeGraphEditor. + { + GUI.EndGroup(); + Rect rect = new Rect(new Vector2(-1f, 20f), new Vector2(Screen.width, Screen.height)); + GUI.BeginGroup(rect); + graphEditor.OnGUI(); + GUI.EndGroup(); + GUI.BeginGroup(new Rect(0.0f, topPadding - (topPadding * zoom), Screen.width, Screen.height)); + } } } \ No newline at end of file