Skip to content

Commit

Permalink
Fix BGM button padding #92
Browse files Browse the repository at this point in the history
  • Loading branch information
drojf committed Oct 30, 2022
1 parent b98499a commit 4e13546
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 3 additions & 3 deletions MOD.Scripts.UI/MODMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -291,12 +291,12 @@ public void OnGUIFragment()
// Below the BGM name, add utility buttons, all one one line
GUILayout.BeginHorizontal(GUILayout.ExpandWidth(false));
{
if (Button($" Copy BGM Name ", options: GUILayout.ExpandWidth(false)))
if (ButtonNoExpandWithPadding($"Copy BGM Name"))
{
GUIUtility.systemCopyBuffer = bgmInfo.name.Trim();
}

if (Button($" Show File ({audioPath}) ", options: GUILayout.ExpandWidth(false)))
if (ButtonNoExpandWithPadding($"Show File ({audioPath})"))
{
string bgmFullPath = Path.Combine(Application.streamingAssetsPath, audioPath);
showBGMButtonPressed = true;
Expand All @@ -305,7 +305,7 @@ public void OnGUIFragment()

if (!string.IsNullOrEmpty(bgmInfo.url))
{
if (GUILayout.Button("Open In Youtube", styleManager.Group.button, GUILayout.ExpandWidth(false)))
if (ButtonNoExpandWithPadding("Open In Youtube"))
{
Application.OpenURL($"https://www.youtube.com/watch?v={bgmInfo.url}");
}
Expand Down
5 changes: 5 additions & 0 deletions MOD.Scripts.UI/MODMenuCommon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ public static void HeadingLabel(string label, bool alignLeft = false, params GUI
GUILayout.Label(label, alignLeft ? MODStyleManager.OnGUIInstance.Group.upperLeftHeadingLabel : MODStyleManager.OnGUIInstance.Group.headingLabel, options);
}

public static bool ButtonNoExpandWithPadding(string label, bool selected = false)
{
return Button(new GUIContent($" {label} "), selected, false, GUILayout.ExpandWidth(false));
}

public static bool Button(string label, bool selected = false, bool stlyeAsLabel = false, params GUILayoutOption[] options)
{
return Button(new GUIContent(label), selected, stlyeAsLabel, options);
Expand Down

0 comments on commit 4e13546

Please sign in to comment.