Skip to content

Commit

Permalink
Fix offset position of the signal delay window
Browse files Browse the repository at this point in the history
  • Loading branch information
KSP-TaxiService committed Jul 4, 2021
1 parent 547bbb0 commit e0f759f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/RemoteTech/UI/TimeWarpDecorator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,15 +151,15 @@ public void Draw()
Vector2 timeWarpImageScreenCoord = UIMainCamera.Camera.WorldToScreenPoint(mTimewarpTransform.position);

float scale = GameSettings.UI_SCALE_TIME * GameSettings.UI_SCALE;
float topLeftTotimeQuadrant = Screen.height - (timeWarpImageScreenCoord.y - (mTimewarpTransform.rect.height * scale));
float YToTimeQuadrant = Screen.height - (timeWarpImageScreenCoord.y - (mTimewarpTransform.rect.height * scale));
float XToTimeQuadrant = 0; //compensated for KSP 1.12 alarm button
float texBackgroundHeight = (mTexBackground.height * 0.7f) * scale;
float texBackgroundWidth = (mTexBackground.width * 0.8111f) * scale;

Rect delaytextPosition = new Rect((timeWarpImageScreenCoord.x + 12.0f) * scale, topLeftTotimeQuadrant + 2 * scale, 50.0f * scale, 20.0f * scale);
Rect delaytextPosition = new Rect((XToTimeQuadrant + 12.0f) * scale, YToTimeQuadrant + 2 * scale, 50.0f * scale, 20.0f * scale);

// calc the position under the timewarp object
Rect pos = new Rect(timeWarpImageScreenCoord.x,
topLeftTotimeQuadrant,
Rect pos = new Rect(XToTimeQuadrant, YToTimeQuadrant,
texBackgroundWidth, texBackgroundHeight);

// draw the image
Expand All @@ -177,7 +177,7 @@ public void Draw()
GUI.Label(delaytextPosition, DisplayText, mTextStyle);

// draw the flightcomputer button to the right relative to the delaytext position
Rect btnPos = new Rect((pos.x + 130.0f) * scale, topLeftTotimeQuadrant + 2 * scale, 21.0f * scale, 21.0f * scale);
Rect btnPos = new Rect((pos.x + 130.0f) * scale, YToTimeQuadrant + 2 * scale, 21.0f * scale, 21.0f * scale);

GUILayout.BeginArea(btnPos);
if (GUILayout.Button("", ButtonStyle))
Expand Down

0 comments on commit e0f759f

Please sign in to comment.