From 7bd3c93238e81a3bf52a2020a8ba730ef9f18cf5 Mon Sep 17 00:00:00 2001 From: chrisgregan Date: Thu, 26 Mar 2015 15:52:30 +0000 Subject: [PATCH] Resize bar works properly with resizing windows Also improved rendering of the bar to match Unity UI. --- .../FungusScript/Editor/SequenceInspector.cs | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/Assets/Fungus/FungusScript/Editor/SequenceInspector.cs b/Assets/Fungus/FungusScript/Editor/SequenceInspector.cs index d009289a..0bb689f0 100644 --- a/Assets/Fungus/FungusScript/Editor/SequenceInspector.cs +++ b/Assets/Fungus/FungusScript/Editor/SequenceInspector.cs @@ -84,7 +84,12 @@ namespace Fungus // 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.color = new Color(0.64f, 0.64f, 0.64f); + GUI.DrawTexture(resizeRect, EditorGUIUtility.whiteTexture); + resizeRect.height = 1; + GUI.color = new Color32(132, 132, 132, 255); + GUI.DrawTexture(resizeRect, EditorGUIUtility.whiteTexture); + resizeRect.y += 3; GUI.DrawTexture(resizeRect, EditorGUIUtility.whiteTexture); GUI.color = Color.white; @@ -103,17 +108,19 @@ namespace Fungus { resize = true; } - + if (resize) { - float height = Event.current.mousePosition.y; - height = Mathf.Max(200, height); - height = Mathf.Min(Screen.height - 200,height); - Undo.RecordObject(fungusScript, "Resize view"); - fungusScript.sequenceViewHeight = height; + fungusScript.sequenceViewHeight = Event.current.mousePosition.y; } + // Make sure sequence view is always visible + float height = fungusScript.sequenceViewHeight; + height = Mathf.Max(200, height); + height = Mathf.Min(Screen.height - 200,height); + fungusScript.sequenceViewHeight = height; + // Stop resizing if mouse is outside inspector window. // This isn't standard Unity UI behavior but it is robust and safe. if (resize && Event.current.type == EventType.mouseDrag)