Skip to content

Commit

Permalink
Update the position for the following HUD buttons to be centered: VIB…
Browse files Browse the repository at this point in the history
…E,EKF,PreArm
  • Loading branch information
Matthew-Alti committed Oct 20, 2023
1 parent 8770187 commit ddb40ae
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions ExtLibs/Controls/HUD.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2852,7 +2852,7 @@ internal void doPaint()
if (displayicons)
{
var bottomsize = ((fontsize + 2) * 3) + fontoffset - 2;
DrawImage(icon, 3, this.Height - bottomsize, bottomsize / 2, bottomsize);
DrawImage(icon, 2, this.Height - bottomsize, bottomsize / 2, bottomsize);

text = _batterylevel.ToString("0.00v") + " " + _current.ToString("0.0 A") + " " + (_batteryremaining) + "%";
drawstring(text, font, fontsize + 1, textcolor, bottomsize / 2 + 6, yPos[1]);
Expand Down Expand Up @@ -3108,8 +3108,16 @@ internal void doPaint()
if (displayicons)
{
var width = (fontsize + 8) * 3;
vibehitzone = new Rectangle(this.Width - (width * 4) + width / 2 - 5, this.Height - (fontsize + 13), (fontsize + 8) * 3, fontsize + 8);

//When the width is greater or equal to 325, the vibe button must be placed at half of the HUD's width
if (this.Width >= 325)
{
vibehitzone = new Rectangle((int)(this.Width * 0.5), this.Height - (fontsize + 13), width, fontsize + 8);
}
//When the width is less than 325, the vibe button must be placed just passed half of the HUD's width
else if (this.Width < 325)
{
vibehitzone = new Rectangle((int)(this.Width * 0.535), this.Height - (fontsize + 13), width, fontsize + 8);
}
}
else
{
Expand Down Expand Up @@ -3161,10 +3169,15 @@ internal void doPaint()

if (displayekf)
{
//Set the starting Position for the EKF button based off of the VIBE Button
//Variable for the Vibe width
var vibeWidth = vibehitzone.Width;
//Variable for the start position of EKF
var eKFLocationX = vibehitzone.X - vibeWidth - 2;
if (displayicons)
{
var width = (fontsize + 8) * 3;
ekfhitzone = new Rectangle(this.Width - width * 5 + width / 2 - 10 , this.Height - (fontsize + 13), (fontsize + 8) * 3, fontsize + 8);
ekfhitzone = new Rectangle((int)(eKFLocationX), this.Height - (fontsize + 13), width, fontsize + 8);
}
else
{
Expand Down Expand Up @@ -3211,10 +3224,12 @@ internal void doPaint()

if (displayprearm && status == false) // not armed
{
//Set the starting Position for the PreArm button - Variable for the start position of PreArm button
var readyToArmLocationX = ekfhitzone.X;
if (displayicons)
{
var width = (fontsize + 8) * 3;
prearmhitzone = new Rectangle(this.Width - width * 5 + width / 2 - 7, this.Height - (fontsize*2 + 25), width * 2, fontsize + 8);
prearmhitzone = new Rectangle(readyToArmLocationX, this.Height - (fontsize*2 + 25), width * 2, fontsize + 8);
}
else
{
Expand Down

0 comments on commit ddb40ae

Please sign in to comment.