diff --git a/src/Internal/Editor/EcsGUI.Layout.cs b/src/Internal/Editor/EcsGUI.Layout.cs index a220d72..f924c73 100644 --- a/src/Internal/Editor/EcsGUI.Layout.cs +++ b/src/Internal/Editor/EcsGUI.Layout.cs @@ -229,7 +229,10 @@ namespace DCFApixels.DragonECS.Unity.Editors RuntimeComponentsUtility.GetAddComponentGenericMenu(world).Open(dropDownRect, entityID); } - GUILayout.Box("", UnityEditorUtility.GetStyle(GUI.color, 0.16f), GUILayout.ExpandWidth(true)); + using (SetBackgroundColor(GUI.color.SetAlpha(0.16f))) + { + GUILayout.Box("", UnityEditorUtility.GetWhiteStyle(), GUILayout.ExpandWidth(true)); + } IsShowHidden = EditorGUI.Toggle(GUILayoutUtility.GetLastRect(), "Show Hidden", IsShowHidden); if (_componentPoolsBuffer == null) diff --git a/src/Internal/Editor/UnityEditorUtility.cs b/src/Internal/Editor/UnityEditorUtility.cs index 435cad3..6a5c684 100644 --- a/src/Internal/Editor/UnityEditorUtility.cs +++ b/src/Internal/Editor/UnityEditorUtility.cs @@ -367,10 +367,11 @@ namespace DCFApixels.DragonECS.Unity.Editors } #endregion - #region WhiteTexture + #region GetDefaultStyle private static Texture2D _whiteTexture; private static GUIStyle _whiteStyle; private static GUIStyle _transperentBlackBackgrounStyle; + private static GUIStyle _clearBackgrounStyle; public static Texture2D GetWhiteTexture() { if (_whiteTexture == null) @@ -379,9 +380,13 @@ namespace DCFApixels.DragonECS.Unity.Editors } return _whiteTexture; } + private static bool IsNotInitializedStyle(GUIStyle style) + { + return style == null || style.normal.background == null; + } public static GUIStyle GetWhiteStyle() { - if (_whiteStyle == null || _whiteStyle.normal.background == null) + if (IsNotInitializedStyle(_whiteStyle)) { _whiteStyle = CreateStyle(GetWhiteTexture(), GUI.skin.label); } @@ -389,12 +394,20 @@ namespace DCFApixels.DragonECS.Unity.Editors } public static GUIStyle GetTransperentBlackBackgrounStyle() { - if (_transperentBlackBackgrounStyle == null || _transperentBlackBackgrounStyle.normal.background == null) + if (IsNotInitializedStyle(_transperentBlackBackgrounStyle)) { _transperentBlackBackgrounStyle = CreateStyle(CreateTexture(2, 2, new Color(0, 0, 0, 0.2f)), GUI.skin.label); } return _transperentBlackBackgrounStyle; } + public static GUIStyle GetClearBackgrounStyle() + { + if (IsNotInitializedStyle(_clearBackgrounStyle)) + { + _clearBackgrounStyle = CreateStyle(CreateTexture(2, 2, new Color(0, 0, 0, 0)), GUI.skin.label); + } + return _clearBackgrounStyle; + } #endregion #region GetStyle diff --git a/src/Tools/DragonDocs/Editors/DragonDocsWindow.cs b/src/Tools/DragonDocs/Editors/DragonDocsWindow.cs index d812074..2cf1b50 100644 --- a/src/Tools/DragonDocs/Editors/DragonDocsWindow.cs +++ b/src/Tools/DragonDocs/Editors/DragonDocsWindow.cs @@ -84,19 +84,20 @@ namespace DCFApixels.DragonECS.Unity.Docs.Editors GUILayout.BeginHorizontal(GUILayout.ExpandHeight(true)); - - ButtonsScrolPosition = GUILayout.BeginScrollView(ButtonsScrolPosition, UnityEditorUtility.GetStyle(Color.black, 0f), GUILayout.Width(_buttonsWidth)); - var selectedGroupInfo = DrawGroups(); - GUILayout.EndScrollView(); + MetaGroupInfo selectedGroupInfo; + using (EcsGUI.Layout.BeginScrollView(ref ButtonsScrolPosition, UnityEditorUtility.GetClearBackgrounStyle(), GUILayout.Width(_buttonsWidth))) + { + selectedGroupInfo = DrawGroups(); + } DrawDragger(); GUILayout.Space(EditorGUIUtility.standardVerticalSpacing * -2f); - - DataScrolPosition = GUILayout.BeginScrollView(DataScrolPosition, UnityEditorUtility.GetTransperentBlackBackgrounStyle(), GUILayout.ExpandWidth(true)); - DrawSelectedGroupMeta(selectedGroupInfo); - GUILayout.EndScrollView(); + using (EcsGUI.Layout.BeginScrollView(ref DataScrolPosition, UnityEditorUtility.GetTransperentBlackBackgrounStyle(), GUILayout.ExpandWidth(true))) + { + DrawSelectedGroupMeta(selectedGroupInfo); + } //GUILayout.Space(EditorGUIUtility.standardVerticalSpacing * -2f); GUILayout.EndHorizontal();