Skip to content

Commit e794335

Browse files
committed
fix: Changed code according to changes in SolidUtilities
1 parent 2371ab0 commit e794335

File tree

4 files changed

+17
-18
lines changed

4 files changed

+17
-18
lines changed

Editor/Drawers/TypeFieldDrawer.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ internal class TypeFieldDrawer
1616
{
1717
private const string MissingSuffix = " {Missing}";
1818
private static readonly int _controlHint = typeof(TypeReferencePropertyDrawer).GetHashCode();
19-
private static readonly ContentCache _contentCache = new ContentCache();
2019

2120
private readonly SerializedTypeReference _serializedTypeRef;
2221
private readonly TypeDropdownDrawer _dropdownDrawer;
@@ -119,7 +118,7 @@ private void DrawFieldContent(int controlID)
119118
{
120119
int indexOfComma = _serializedTypeRef.TypeNameAndAssembly.IndexOf(',');
121120
string fullTypeName = indexOfComma == -1 ? string.Empty : _serializedTypeRef.TypeNameAndAssembly.Substring(0, indexOfComma);
122-
GUIContent fieldContent = _contentCache.GetItem(GetTypeToShow(fullTypeName));
121+
GUIContent fieldContent = GUIContentHelper.Temp(GetTypeToShow(fullTypeName));
123122
EditorStyles.popup.Draw(_position, fieldContent, controlID);
124123
}
125124

Editor/TypeDropdown/DropdownWindow.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ private Rect GetWindowRect(Vector2 windowPosition, float windowHeight)
8686
{
8787
// If the window width is smaller than the distance from cursor to the right border of the window, the
8888
// window will not appear because the cursor is outside of the window and OnGUI will never be called.
89-
float screenWidth = EditorDrawHelper.GetScreenWidth();
89+
float screenWidth = EditorGUIUtilityHelper.GetScreenWidth();
9090
windowPosition.x -= 8f; // This will make the window appear so that foldout arrows are precisely below the cursor.
9191
float distanceToRightBorder = screenWidth - windowPosition.x;
9292

@@ -101,11 +101,11 @@ private Rect GetWindowRect(Vector2 windowPosition, float windowHeight)
101101
const float minHeightOnStart = 100f;
102102
windowHeight = windowHeight < 100f ? minHeightOnStart : windowHeight;
103103

104-
float distanceToBottomBorder = EditorDrawHelper.GetMainWindowPosition().yMax - windowPosition.y;
104+
float distanceToBottomBorder = EditorGUIUtilityHelper.GetMainWindowPosition().yMax - windowPosition.y;
105105

106106
if (distanceToBottomBorder < windowHeight)
107107
{
108-
windowPosition.y = EditorDrawHelper.GetMainWindowPosition().yMax - windowHeight;
108+
windowPosition.y = EditorGUIUtilityHelper.GetMainWindowPosition().yMax - windowHeight;
109109
}
110110

111111
var windowSize = new Vector2(distanceToRightBorder, windowHeight);
@@ -168,7 +168,7 @@ private void DrawContent()
168168
{
169169
using (new FixedRect(_preventExpandingHeight, position.width))
170170
{
171-
using (new EditorDrawHelper.VerticalBlock(_preventExpandingHeight,
171+
using (EditorGUILayoutHelper.VerticalBlock(_preventExpandingHeight,
172172
DropdownStyle.BackgroundColor, out float contentHeight))
173173
{
174174
_selectionTree.Draw();
@@ -177,7 +177,7 @@ private void DrawContent()
177177
_contentHeight = contentHeight;
178178
}
179179

180-
EditorDrawHelper.DrawBorders(position.width, position.height, DropdownStyle.BorderColor);
180+
EditorGUIHelper.DrawBorders(position.width, position.height, DropdownStyle.BorderColor);
181181
}
182182
}
183183

Editor/TypeDropdown/Scrollbar.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,23 +64,23 @@ private void ScrollToNode(Rect nodeRect)
6464
public readonly struct ScrollbarScope : IDisposable
6565
{
6666
private readonly Scrollbar _scrollbar;
67-
private readonly EditorDrawHelper.VerticalBlock _outerVerticalBlock;
68-
private readonly EditorDrawHelper.ScrollView _scrollView;
69-
private readonly EditorDrawHelper.VerticalBlock _innerVerticalBlock;
67+
private readonly EditorGUILayoutHelper.Vertical _outerVerticalBlock;
68+
private readonly EditorGUILayoutHelper.ScrollView _scrollView;
69+
private readonly EditorGUILayoutHelper.Vertical _innerVerticalBlock;
7070
private readonly Rect _newWholeListRect;
7171

7272
public ScrollbarScope(Scrollbar scrollbar)
7373
{
7474
_scrollbar = scrollbar;
7575

76-
_outerVerticalBlock = new EditorDrawHelper.VerticalBlock(out Rect windowRect);
76+
_outerVerticalBlock = EditorGUILayoutHelper.VerticalBlock(out Rect windowRect);
7777

7878
if (Event.current.type == EventType.Repaint)
7979
_scrollbar._windowRect = windowRect;
8080

81-
_scrollView = new EditorDrawHelper.ScrollView(ref _scrollbar._position, _scrollbar._visible);
81+
_scrollView = EditorGUILayoutHelper.ScrollViewBlock(ref _scrollbar._position, _scrollbar._visible);
8282

83-
_innerVerticalBlock = new EditorDrawHelper.VerticalBlock(out _newWholeListRect);
83+
_innerVerticalBlock = EditorGUILayoutHelper.VerticalBlock(out _newWholeListRect);
8484
}
8585

8686
public void Dispose()

Editor/TypeDropdown/SelectionTree.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,9 @@ public void Draw()
9797

9898
private static void DrawInfoMessage()
9999
{
100-
using (new DrawHelper.VerticalBlock(DropdownStyle.NoPadding))
100+
using (new GUILayoutHelper.Vertical(DropdownStyle.NoPadding))
101101
{
102-
EditorDrawHelper.DrawInfoMessage("No types to select.");
102+
EditorGUILayoutHelper.DrawInfoMessage("No types to select.");
103103
}
104104
}
105105

@@ -187,7 +187,7 @@ private static Rect GetInnerToolbarArea()
187187
Rect outerToolbarArea = GUILayoutUtility.GetRect(
188188
0f,
189189
DropdownStyle.SearchToolbarHeight,
190-
DrawHelper.ExpandWidth(true));
190+
GUILayoutHelper.ExpandWidth(true));
191191

192192
Rect innerToolbarArea = outerToolbarArea
193193
.AddHorizontalPadding(10f, 2f)
@@ -208,10 +208,10 @@ private string DrawSearchField(Rect innerToolbarArea, string searchText)
208208
{
209209
(Rect searchFieldArea, Rect buttonRect) = innerToolbarArea.CutVertically(DropdownStyle.IconSize, true);
210210

211-
searchText = EditorDrawHelper.FocusedTextField(searchFieldArea, searchText, "Search",
211+
searchText = EditorGUIHelper.FocusedTextField(searchFieldArea, searchText, "Search",
212212
DropdownStyle.SearchToolbarStyle, _searchFieldControlName);
213213

214-
if (DrawHelper.CloseButton(buttonRect))
214+
if (GUIHelper.CloseButton(buttonRect))
215215
{
216216
searchText = string.Empty;
217217
GUI.FocusControl(null); // Without this, the old text does not disappear for some reason.

0 commit comments

Comments
 (0)