Skip to content

Commit 564204f

Browse files
committed
Make minimized panel draggable along the edge.
1 parent be75040 commit 564204f

3 files changed

Lines changed: 16 additions & 6 deletions

File tree

EasyScale/Mod.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ public override void OnLoad()
5252
PrescalePanel.Position = new Vector2(
5353
Configuration.GetFloat("prescale-pos-x", 500),
5454
Configuration.GetFloat("prescale-pos-y", 500));
55+
PrescalePanel.MinimizedHeight = Configuration.GetFloat("minimized-height", 400);
5556

5657
SettingsMenu.RegisterSettingsButton("SCALE", ToggleEnabled, ModEnabled, 12);
5758

@@ -72,6 +73,7 @@ public override void OnUnload()
7273
Configuration.SetBool("prescale", PrescaleEnabled);
7374
Configuration.SetFloat("prescale-pos-x", PrescalePanel.Position.x);
7475
Configuration.SetFloat("prescale-pos-y", PrescalePanel.Position.y);
76+
Configuration.SetFloat("minimized-height", PrescalePanel.MinimizedHeight);
7577
Configuration.Save();
7678
}
7779

EasyScale/PrescalePanel.cs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,9 @@ public static GUISkin Skin
8282
}
8383
}
8484

85-
public Vector2 MinimizedPosition => new Vector2(42 - WindowRect.width, Screen.height - 400);
85+
private Vector2 MinimizedPosition => new Vector2(42 - WindowRect.width, Screen.height - MinimizedHeight);
86+
87+
public static float MinimizedHeight { get; set; }
8688
public static Vector2 Position { get; set; }
8789

8890
private static float DrawSlider(string label, float value, float min, float max, string oldText, out string newText)
@@ -119,7 +121,13 @@ private void OnGUI()
119121
GUI.skin = Skin;
120122
WindowRect = GUI.Window(WindowID, WindowRect, DoWindow, "", Elements.Windows.ClearDark);
121123

122-
if (!Minimized && !Animating) Position = WindowRect.position;
124+
if (!Animating)
125+
{
126+
if (!Minimized)
127+
Position = WindowRect.position;
128+
else
129+
MinimizedHeight = Screen.height - WindowRect.position.y;
130+
}
123131
}
124132

125133
private void DoWindow(int id)
@@ -131,6 +139,7 @@ private void DoWindow(int id)
131139
{
132140
var tmpScale = Scale;
133141

142+
GUILayout.Label("<color=#888888><b>ADJUST BLOCK SCALE</b></color>", new GUIStyle(Elements.Labels.Default) {alignment = TextAnchor.MiddleCenter});
134143
GUILayout.FlexibleSpace();
135144
tmpScale.x = DrawSlider("<b>X</b>", tmpScale.x, 0.1f, 3f, _xSliderString, out _xSliderString);
136145
GUILayout.FlexibleSpace();
@@ -171,8 +180,7 @@ private void DoWindow(int id)
171180
GUILayout.EndHorizontal();
172181

173182
// Drag window
174-
if (!Minimized)
175-
GUI.DragWindow(new Rect(0, 0, WindowRect.width, WindowRect.height));
183+
GUI.DragWindow(new Rect(0, 0, WindowRect.width, WindowRect.height));
176184
}
177185

178186
private IEnumerator Restore()

EasyScale/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("1.2.0.0")]
36-
[assembly: AssemblyFileVersion("1.2.0.0")]
35+
[assembly: AssemblyVersion("1.2.1.0")]
36+
[assembly: AssemblyFileVersion("1.2.1.0")]

0 commit comments

Comments
 (0)