Skip to content

Commit 9c5faca

Browse files
committed
Implemented setting for enabling/disabling whether the toolbar icon in-flight activates on mouse hover.
1 parent 702d2fc commit 9c5faca

File tree

3 files changed

+27
-2
lines changed

3 files changed

+27
-2
lines changed

KerbalEngineer/Editor/BuildAdvanced.cs

+5
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,11 @@ private void DrawSettings()
547547
FlightEngineerCore.IsTrackingStationLimited = GUILayout.Toggle(FlightEngineerCore.IsTrackingStationLimited, "TRACKING", buttonStyle, GUILayout.Width(100.0f * GuiDisplaySize.Offset));
548548
GUILayout.EndHorizontal();
549549

550+
GUILayout.BeginHorizontal();
551+
GUILayout.Label("Flight Engineer Toolbar Icon:", settingStyle);
552+
FlightAppLauncher.IsHoverActivated = GUILayout.Toggle(FlightAppLauncher.IsHoverActivated, "MOUSE HOVER", buttonStyle, GUILayout.Width(125.0f * GuiDisplaySize.Offset));
553+
GUILayout.EndHorizontal();
554+
550555
GUILayout.BeginHorizontal();
551556
GUILayout.Label("Key Bindings:", settingStyle);
552557
if (GUILayout.Button("EDIT KEY BINDINGS", buttonStyle, GUILayout.Width(200.0f * GuiDisplaySize.Offset)))

KerbalEngineer/Flight/FlightAppLauncher.cs

+22-2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ namespace KerbalEngineer.Flight
2121
using System.Collections.Generic;
2222
using KSP.UI;
2323
using Sections;
24+
using Settings;
2425
using Unity.Flight;
2526
using UnityEngine;
2627

@@ -121,6 +122,22 @@ public bool IsDisplayStackVisible
121122
}
122123
}
123124

125+
/// <summary>
126+
/// Gets or sets whether the flight app launcher UI is activated via mouse hovering.
127+
/// </summary>
128+
public static bool IsHoverActivated
129+
{
130+
get
131+
{
132+
return GeneralSettings.Handler.Get("FlightAppLauncher_IsHoverActivated", true);
133+
}
134+
135+
set
136+
{
137+
GeneralSettings.Handler.Set("FlightAppLauncher_IsHoverActivated", value);
138+
}
139+
}
140+
124141
/// <summary>
125142
/// Creates and initialises a new custom section.
126143
/// </summary>
@@ -161,12 +178,15 @@ protected override void OnFalse()
161178

162179
protected override void OnHover()
163180
{
164-
Open();
181+
if (IsHoverActivated)
182+
{
183+
Open();
184+
}
165185
}
166186

167187
protected override void OnHoverOut()
168188
{
169-
if (IsOn == false)
189+
if (IsOn == false && IsHoverActivated)
170190
{
171191
Close();
172192
}
2 KB
Binary file not shown.

0 commit comments

Comments
 (0)