better 'Clear' button

This commit is contained in:
in0finite 2019-07-28 19:58:13 +02:00
parent d58482d524
commit 5bdcf84ee0
2 changed files with 7 additions and 3 deletions

View file

@ -239,7 +239,7 @@ namespace SanAndreasUnity.UI
GUILayout.BeginHorizontal ();
if (GUILayout.Button (s_clearLabel, GUILayout.Width(80), GUILayout.Height(25)))
if (Utilities.GUIUtils.ButtonWithCalculatedSize (s_clearLabel))
{
m_logs.Clear();
m_selectedLogIndex = -1;

View file

@ -82,10 +82,14 @@ namespace SanAndreasUnity.Utilities
}
public static bool ButtonWithCalculatedSize( string text ) {
return ButtonWithCalculatedSize(new GUIContent(text));
}
Vector2 size = CalcScreenSizeForText (text, GUI.skin.button);
public static bool ButtonWithCalculatedSize(GUIContent content)
{
Vector2 size = CalcScreenSizeForContent (content, GUI.skin.button);
return GUILayout.Button (text, GUILayout.Width (size.x), GUILayout.Height (size.y));
return GUILayout.Button (content, GUILayout.Width (size.x), GUILayout.Height (size.y));
}
public static bool ButtonWithColor( Rect rect, string text, Color color) {