Skip to content

Commit

Permalink
(finally) adds a scrollbar on the Settings GUI.
Browse files Browse the repository at this point in the history
For #43
  • Loading branch information
Lisias committed Aug 1, 2024
1 parent eb2b065 commit 0e975a0
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Source/DistantObject/SettingsGui.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ private void OnDestroy()
partial class SettingsGui
{
protected Rect windowPos = new Rect(Screen.width / 4, Screen.height / 4, 10f, 10f);
protected Vector2 scrollViewPosition = new Vector2();

private static bool activated = false;
private bool isActivated = false;
Expand Down Expand Up @@ -246,6 +247,7 @@ private void mainGUI(int windowID)
GUILayoutOption guiwidth220 = GUILayout.Width(220);

GUILayout.BeginVertical();
this.scrollViewPosition = GUILayout.BeginScrollView(this.scrollViewPosition, false, true);

GUILayout.BeginHorizontal(GUILayout.ExpandWidth(false));
GUIStyle style = GUI.skin.GetStyle("label");
Expand Down Expand Up @@ -466,7 +468,8 @@ private void mainGUI(int windowID)
}
GUILayout.EndHorizontal();

GUILayout.EndVertical();
GUILayout.EndScrollView();
GUILayout.EndVertical();
GUI.DragWindow();
}

Expand All @@ -488,7 +491,8 @@ internal void drawGUI()
{
ReadSettings();
}
windowPos = GUILayout.Window(-5234628, windowPos, mainGUI, Globals.DistantObject + " Settings", GUILayout.Width(300), GUILayout.Height(200));

windowPos = GUILayout.Window(-5234628, windowPos, mainGUI, Globals.DistantObject + " Settings", GUILayout.Width(320), GUILayout.Height(600));
}
isActivated = activated;
}
Expand Down

0 comments on commit 0e975a0

Please sign in to comment.