Skip to content

Commit

Permalink
Make mod menu button more visible
Browse files Browse the repository at this point in the history
  • Loading branch information
drojf committed Oct 29, 2022
1 parent 802f4a3 commit a710aae
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions MOD.Scripts.UI/MODMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -172,15 +172,19 @@ private void OnGUIConfigMenuButton(string text, float? alpha, Action action)
}

// Calculate the width and height of the button
float areaWidth = Screen.width / 8;
float areaHeight = Mathf.Round(styleManager.Group.button.CalcHeight(new GUIContent(text, ""), areaWidth)) + 10;
float areaWidth = Screen.width / 8 + Screen.width / 64;
float areaHeight = Mathf.Max(
Mathf.Round(styleManager.Group.button.CalcHeight(new GUIContent(text, ""), areaWidth)) + 10,
3 * Screen.height / 32
);

// Figure out the position of the overlay's top left hand corner
float xOffset = 0;
float yOffset = 0;
// Position the top-left x so the button is aligned with the config menu background, with a small margin
float xOffset = Screen.width / 8 + Screen.width / 64;
// Position the top-left y to vertically center the button
float yOffset = Screen.height / 2 - areaHeight/2;

GUILayout.BeginArea(new Rect(xOffset, yOffset, areaWidth, areaHeight), styleManager.modMenuAreaStyle);
if (GUILayout.Button(text, styleManager.Group.button))
if (Button(text, options: GUILayout.ExpandHeight(true)))
{
action();
}
Expand Down

0 comments on commit a710aae

Please sign in to comment.