Added orbital speed & fixed target selector resizing.
[VesselSimulator.git] / KerbalEngineer / Flight / Readouts / Rendezvous / TargetSelector.cs
blob:a/KerbalEngineer/Flight/Readouts/Rendezvous/TargetSelector.cs -> blob:b/KerbalEngineer/Flight/Readouts/Rendezvous/TargetSelector.cs
--- a/KerbalEngineer/Flight/Readouts/Rendezvous/TargetSelector.cs
+++ b/KerbalEngineer/Flight/Readouts/Rendezvous/TargetSelector.cs
@@ -21,6 +21,7 @@
         private bool typeIsBody;

         private bool usingSearch;

         private VesselType vesselType = VesselType.Unknown;

+        private ITargetable targetObject;

 

         #endregion

 

@@ -67,6 +68,12 @@
             {

                 this.DrawTarget();

             }

+

+            if (this.targetObject != FlightGlobals.fetch.VesselTarget)

+            {

+                this.targetObject = FlightGlobals.fetch.VesselTarget;

+                this.ResizeRequested = true;

+            }  

         }

 

         /// <summary>

@@ -164,7 +171,7 @@
         /// </summary>

         private void DrawTarget()

         {

-            if (GUILayout.Button("Go Back to Target Selection", this.ButtonStyle))

+            if (GUILayout.Button("Go Back to Target Selection", this.ButtonStyle, GUILayout.Width(this.ContentWidth)))

             {

                 FlightGlobals.fetch.SetVesselTarget(null);

                 this.ResizeRequested = true;

@@ -180,7 +187,7 @@
         /// </summary>

         private void DrawBackToTypes()

         {

-            if (GUILayout.Button("Go Back to Type Selection", this.ButtonStyle))

+            if (GUILayout.Button("Go Back to Type Selection", this.ButtonStyle, GUILayout.Width(this.ContentWidth)))

             {

                 this.typeIsBody = false;

                 this.vesselType = VesselType.Unknown;

@@ -248,7 +255,7 @@
                 }

 

                 count++;

-                if (GUILayout.Button(body.bodyName, this.ButtonStyle))

+                if (GUILayout.Button(body.bodyName, this.ButtonStyle, GUILayout.Width(this.ContentWidth)))

                 {

                     this.SetTargetAs(body);

                 }

@@ -275,7 +282,7 @@
                 }

 

                 count++;

-                if (GUILayout.Button(body.GetName(), this.ButtonStyle))

+                if (GUILayout.Button(body.GetName(), this.ButtonStyle, GUILayout.Width(this.ContentWidth)))

                 {

                     this.SetTargetAs(body);

                 }

@@ -300,7 +307,7 @@
                 {

                     count++;

 

-                    if (GUILayout.Button(vessel.GetName(), this.ButtonStyle))

+                    if (GUILayout.Button(vessel.GetName(), this.ButtonStyle, GUILayout.Width(this.ContentWidth)))

                     {

                         this.SetTargetAs(vessel);

                     }

@@ -308,7 +315,7 @@
                 else if (vessel.vesselName.ToLower().Contains(this.searchQuery))

                 {

                     count++;

-                    if (GUILayout.Button(vessel.GetName(), this.ButtonStyle))

+                    if (GUILayout.Button(vessel.GetName(), this.ButtonStyle, GUILayout.Width(this.ContentWidth)))

                     {

                         this.SetTargetAs(vessel);

                     }

@@ -332,6 +339,7 @@
         private void SetTargetAs(ITargetable target)

         {

             FlightGlobals.fetch.SetVesselTarget(target);

+            this.targetObject = target;

             this.ResizeRequested = true;

         }