Skip to content

Commit b61d047

Browse files
committed
button style minor optimizations
1 parent d13d878 commit b61d047

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

Assets/Editor/Editor Windows/ScriptableObjectEditorWindow.cs

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ public static string[] BasicFilters
5757
GUIContent AddConfigButton;
5858
GUILayoutOption[] AddConfigButtonOptions;
5959
GUIStyle buttonStyle;
60+
// delete config button styles:
61+
GUIContent deleteConfigButton;
62+
GUILayoutOption[] deleteConfigButtonOptions;
6063

6164
// label styles:
6265
GUIStyle centeredLabelStyle;
@@ -150,6 +153,18 @@ private void SetupButtonStyles()
150153
AddConfigButton = new GUIContent("Add new", "create new config");
151154
AddConfigButtonOptions = new GUILayoutOption[] { GUILayout.Width(65) };
152155
}
156+
157+
// 'delete config' button styles
158+
if (deleteConfigIcon != null)
159+
{
160+
deleteConfigButton = new GUIContent(deleteConfigIcon, "delete config permanently");
161+
deleteConfigButtonOptions = new GUILayoutOption[] { GUILayout.Height(20), GUILayout.Width(20) };
162+
}
163+
else
164+
{
165+
deleteConfigButton = new GUIContent("del", "delete config permanently");
166+
deleteConfigButtonOptions = new GUILayoutOption[] { GUILayout.Width(30) };
167+
}
153168
}
154169

155170
private void OnGUI()
@@ -477,25 +492,14 @@ private void PutPropertiesForObject_V<T>(List<T> Configs) where T : ScriptableOb
477492

478493
private void DeleteButton<T>(T Config) where T : ScriptableObject
479494
{
480-
GUIContent deleteConfigButton;
481-
GUILayoutOption[] deleteConfigButtonOptions;
495+
482496
GUIStyle buttonStyle = new GUIStyle(GUI.skin.button);
483497

484498
if (deleteConfigIcon != null)
485499
{
486-
deleteConfigButton = new GUIContent(deleteConfigIcon, "delete config permanently");
487-
deleteConfigButtonOptions = new GUILayoutOption[] { GUILayout.Height(20), GUILayout.Width(20) };
488-
489-
// Ýkon için padding'i azalt
490500
buttonStyle.padding = new RectOffset(2, 2, 2, 2);
491-
// Ýkonun buton içindeki boyutunu ayarla
492501
buttonStyle.imagePosition = ImagePosition.ImageOnly;
493502
}
494-
else
495-
{
496-
deleteConfigButton = new GUIContent("del", "delete config permanently");
497-
deleteConfigButtonOptions = new GUILayoutOption[] { GUILayout.Width(30) };
498-
}
499503

500504
if (GUILayout.Button(deleteConfigButton, buttonStyle, deleteConfigButtonOptions))
501505
{

0 commit comments

Comments
 (0)