From 8c023c413ea9edb5d048a6cf1c8ed0b0fa02004f Mon Sep 17 00:00:00 2001 From: chrisgregan Date: Thu, 26 Mar 2015 15:07:58 +0000 Subject: [PATCH] Fixed incorrect indenting on sequence list & common view --- .../FungusScript/Editor/SequenceInspector.cs | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/Assets/Fungus/FungusScript/Editor/SequenceInspector.cs b/Assets/Fungus/FungusScript/Editor/SequenceInspector.cs index d3d3c223..d009289a 100644 --- a/Assets/Fungus/FungusScript/Editor/SequenceInspector.cs +++ b/Assets/Fungus/FungusScript/Editor/SequenceInspector.cs @@ -39,6 +39,10 @@ namespace Fungus SequenceEditor sequenceEditor = Editor.CreateEditor(sequence) as SequenceEditor; sequenceEditor.DrawSequenceName(fungusScript); + // Using a custom rect area to get the correct 5px indent for the scroll views + Rect sequenceRect = new Rect(5, topPanelHeight, Screen.width - 6, Screen.height); + GUILayout.BeginArea(sequenceRect); + sequenceScrollPos = GUILayout.BeginScrollView(sequenceScrollPos, GUILayout.Height(fungusScript.sequenceViewHeight)); sequenceEditor.DrawSequenceGUI(fungusScript); GUILayout.EndScrollView(); @@ -75,6 +79,15 @@ namespace Fungus GUILayout.EndScrollView(); + GUILayout.EndArea(); + + // Draw the resize bar after everything else has finished drawing + // This is mainly to avoid incorrect indenting. + Rect resizeRect = new Rect(0, topPanelHeight + fungusScript.sequenceViewHeight + 1, Screen.width, 4f); + GUI.color = Color.grey; + GUI.DrawTexture(resizeRect, EditorGUIUtility.whiteTexture); + GUI.color = Color.white; + Repaint(); DestroyImmediate(sequenceEditor); @@ -82,11 +95,7 @@ namespace Fungus private void ResizeScrollView(FungusScript fungusScript) { - Rect cursorChangeRect = new Rect(0, fungusScript.sequenceViewHeight + topPanelHeight, Screen.width, 4f); - - GUI.color = Color.grey; - GUI.DrawTexture(cursorChangeRect, EditorGUIUtility.whiteTexture); - GUI.color = Color.white; + Rect cursorChangeRect = new Rect(0, fungusScript.sequenceViewHeight + 1, Screen.width, 4f); EditorGUIUtility.AddCursorRect(cursorChangeRect, MouseCursor.ResizeVertical); @@ -97,7 +106,7 @@ namespace Fungus if (resize) { - float height = Event.current.mousePosition.y - topPanelHeight; + float height = Event.current.mousePosition.y; height = Mathf.Max(200, height); height = Mathf.Min(Screen.height - 200,height);