Close bodies menu if mouse click off menu.
[VesselSimulator.git] / KerbalEngineer / Editor / BuildAdvanced.cs
blob:a/KerbalEngineer/Editor/BuildAdvanced.cs -> blob:b/KerbalEngineer/Editor/BuildAdvanced.cs
--- a/KerbalEngineer/Editor/BuildAdvanced.cs
+++ b/KerbalEngineer/Editor/BuildAdvanced.cs
@@ -63,7 +63,6 @@
 
         #region Styles
 
-        private GUIStyle areaBodiesStyle;
         private GUIStyle areaSettingStyle;
         private GUIStyle areaStyle;
         private GUIStyle buttonStyle;
@@ -139,18 +138,8 @@
         }
 
         /// <summary>
-        ///     Gets and sets whether to show the reference body selection.
-        /// </summary>
-        public bool ShowReferenceBodies
-        {
-            get { return this.showReferenceBodies; }
-            set
-            {
-                this.showReferenceBodies = value;
-                Logger.Log("BuildAdvanced->ShowReferenceBodies = " + value);
-            }
-        }
-
+        ///     Gets and sets whether to show the settings display.
+        /// </summary>
         public bool ShowSettings
         {
             get { return this.showSettings; }
@@ -194,11 +183,6 @@
                 this.areaStyle = new GUIStyle(HighLogic.Skin.box)
                 {
                     padding = new RectOffset(0, 0, 9, 0)
-                };
-
-                this.areaBodiesStyle = new GUIStyle(HighLogic.Skin.box)
-                {
-                    padding = new RectOffset()
                 };
 
                 this.areaSettingStyle = new GUIStyle(HighLogic.Skin.box)
@@ -277,7 +261,6 @@
                     return;
                 }
 
-                this.bodiesList.enabled = this.showReferenceBodies;
                 this.bodiesList.SetPosition(this.referenceBodiesButtonRect.x + this.windowPosition.x, this.referenceBodiesButtonRect.y + this.referenceBodiesButtonRect.height + this.windowPosition.y, this.referenceBodiesButtonRect.width);
 
                 // Configure the simulation parameters based on the selected reference body.
@@ -420,11 +403,7 @@
                     }
 
                     this.referenceBodiesButtonRect = new Rect(this.windowPosition.width - 452.0f * GuiDisplaySize.Offset, 5.0f, 125.0f * GuiDisplaySize.Offset, 20.0f);
-                    if (GUI.Toggle(this.referenceBodiesButtonRect, this.showReferenceBodies, "BODY: " + CelestialBodies.SelectedBody.Name.ToUpper(), this.buttonStyle) != this.showReferenceBodies)
-                    {
-                        this.hasChanged = true;
-                        this.showReferenceBodies = !this.showReferenceBodies;
-                    }
+                    this.bodiesList.enabled = GUI.Toggle(this.referenceBodiesButtonRect, this.bodiesList.enabled, "BODY: " + CelestialBodies.SelectedBody.Name.ToUpper(), this.buttonStyle);
                 }
 
                 // Draw the main informational display box.