[Fix] Button Size

This commit is contained in:
2026-03-30 13:13:57 +07:00
parent 129fcf783b
commit 65566e565d
+34 -12
View File
@@ -13,6 +13,7 @@ namespace Project.Tasks.Editor
private const float MinDetailsWidth = 320f;
private const float MinBoardWidth = 420f;
private const float SplitterWidth = 5f;
private const float MinButtonSize = 9f;
private const string CustomOwnerOption = "<Custom>";
private const string DetailsWidthPrefsKey = "Project.Tasks.Editor.TaskBoardWindow.DetailsWidth";
private const double DeleteConfirmTimeoutSeconds = 3.0;
@@ -54,6 +55,7 @@ namespace Project.Tasks.Editor
private GUIStyle readOnlyWrappedTextArea;
private GUIStyle priorityBadgeStyle;
private GUIStyle compactButtonStyle;
private TaskRecord pressedTask;
private Vector2 pressedMousePosition;
private float detailsWidth = DefaultDetailsWidth;
@@ -119,18 +121,18 @@ namespace Project.Tasks.Editor
{
EditorGUILayout.BeginHorizontal(EditorStyles.toolbar);
if (GUILayout.Button("Reload", EditorStyles.toolbarButton, GUILayout.Width(60f)))
if (GUILayout.Button("Reload", EditorStyles.toolbarButton))
{
Reload(selectedTask != null ? selectedTask.Id : null);
}
if (GUILayout.Button("Open Index", EditorStyles.toolbarButton, GUILayout.Width(80f)))
if (GUILayout.Button("Index", EditorStyles.toolbarButton))
{
string indexPath = data != null ? data.IndexPath : TaskBoardService.NormalizePath(System.IO.Path.Combine(TaskBoardService.GetProjectRoot(), "docs", "tasks", "Index.md"));
TaskBoardService.OpenInDefaultApp(indexPath);
}
if (GUILayout.Button("Owners Config", EditorStyles.toolbarButton, GUILayout.Width(95f)))
if (GUILayout.Button("Owners", EditorStyles.toolbarButton))
{
OpenOwnersConfig();
}
@@ -194,15 +196,17 @@ namespace Project.Tasks.Editor
return;
}
GUIStyle buttonStyle = GetCompactButtonStyle();
EditorGUILayout.BeginVertical("box");
EditorGUILayout.BeginHorizontal();
EditorGUILayout.LabelField(label, EditorStyles.boldLabel);
if (GUILayout.Button("All", GUILayout.Width(45f)))
if (GUILayout.Button("All", buttonStyle))
{
SetAll(selectedValues, options, true);
}
if (GUILayout.Button("Nothing", GUILayout.Width(65f)))
if (GUILayout.Button("Nothing", buttonStyle))
{
selectedValues.Clear();
}
@@ -213,7 +217,7 @@ namespace Project.Tasks.Editor
{
string option = options[i];
bool current = selectedValues.Contains(option);
bool next = GUILayout.Toggle(current, option, "Button");
bool next = GUILayout.Toggle(current, option, buttonStyle);
if (next != current)
{
if (next)
@@ -315,7 +319,7 @@ namespace Project.Tasks.Editor
EditorGUILayout.HelpBox(task.ValidationMessages[0], MessageType.Warning);
}
if (GUILayout.Button("Open Details"))
if (GUILayout.Button("Details", GetCompactButtonStyle()))
{
SelectTask(task);
}
@@ -354,10 +358,12 @@ namespace Project.Tasks.Editor
EditorGUILayout.HelpBox("Task-файл отсутствует. Поля из task-файла недоступны до создания файла по шаблону.", MessageType.Info);
}
GUIStyle btn = GetCompactButtonStyle();
EditorGUILayout.BeginHorizontal();
using (new EditorGUI.DisabledScope(!selectedTask.FileExists))
{
if (GUILayout.Button("Open Task File"))
if (GUILayout.Button("File", btn, GUILayout.Width(75f), GUILayout.Height(18f)))
{
TaskBoardService.OpenInDefaultApp(selectedTask.AbsoluteFilePath);
}
@@ -365,13 +371,13 @@ namespace Project.Tasks.Editor
using (new EditorGUI.DisabledScope(selectedTask.FileExists))
{
if (GUILayout.Button("Create From Template"))
if (GUILayout.Button("Create", btn, GUILayout.Width(75f), GUILayout.Height(18f)))
{
CreateSelectedTaskFromTemplate();
}
}
if (GUILayout.Button("Open Index"))
if (GUILayout.Button("Index", btn, GUILayout.Width(75f), GUILayout.Height(18f)))
{
TaskBoardService.OpenInDefaultApp(data.IndexPath);
}
@@ -449,7 +455,7 @@ namespace Project.Tasks.Editor
using (new EditorGUI.DisabledScope(!hasChanges || !executionTimeValid))
{
if (GUILayout.Button("Save Changes"))
if (GUILayout.Button("Save", GetCompactButtonStyle()))
{
SaveSelectedTask();
}
@@ -466,7 +472,7 @@ namespace Project.Tasks.Editor
bool isPending = string.Equals(pendingDeleteTaskId, selectedTask.Id, StringComparison.OrdinalIgnoreCase) && EditorApplication.timeSinceStartup <= pendingDeleteUntil;
Color previous = GUI.backgroundColor;
GUI.backgroundColor = isPending ? new Color(0.85f, 0.3f, 0.3f) : new Color(0.7f, 0.25f, 0.25f);
if (GUILayout.Button(isPending ? "Sure?" : "Delete Task"))
if (GUILayout.Button(isPending ? "Sure?" : "Delete Task", GetCompactButtonStyle(), GUILayout.Width(75f), GUILayout.Height(18f)))
{
if (isPending)
{
@@ -545,6 +551,22 @@ namespace Project.Tasks.Editor
return priorityBadgeStyle;
}
private GUIStyle GetCompactButtonStyle()
{
if (compactButtonStyle == null)
{
compactButtonStyle = new GUIStyle("Button")
{
alignment = TextAnchor.MiddleCenter,
padding = new RectOffset(4, 4, 2, 2),
margin = new RectOffset(1, 1, 1, 1),
stretchWidth = true,
};
}
return compactButtonStyle;
}
private void DrawPriorityBadge(string priority)
{
GUIStyle style = GetPriorityBadgeStyle();