diff --git a/LemonUI/Menus/NativeMenu.cs b/LemonUI/Menus/NativeMenu.cs index 236fbc17..051b8fcd 100644 --- a/LemonUI/Menus/NativeMenu.cs +++ b/LemonUI/Menus/NativeMenu.cs @@ -853,19 +853,15 @@ private void TriggerSelectedItem() /// private void RecalculatePanel() { - // If the selected item has a panel - if (SelectedItem?.Panel != null) + if (SelectedItem?.Panel == null) { - // Save the Y value of the description - float y = descriptionRect.Position.Y; - // If it has text, show it after the description instead of taking it's place - if (!string.IsNullOrWhiteSpace(descriptionText.Text)) - { - y += descriptionRect.Size.Height + 10; - } - // Finally, set the position of the panel - SelectedItem.Panel.Recalculate(new PointF(descriptionRect.Position.X, y), Width); + return; } + + const int separation = 10; + + PointF position = new PointF(descriptionRect.Position.X, descriptionRect.Position.Y + descriptionRect.Size.Height + separation); + SelectedItem.Panel.Recalculate(position, Width); } /// /// Resets the current position of the cursor. diff --git a/LemonUI/Menus/NativeStatsInfo.cs b/LemonUI/Menus/NativeStatsInfo.cs index 5a675c56..f26705ca 100644 --- a/LemonUI/Menus/NativeStatsInfo.cs +++ b/LemonUI/Menus/NativeStatsInfo.cs @@ -12,6 +12,8 @@ public class NativeStatsInfo { #region Fields + private const float barWidth = 33; + private const float barHeight = 9; private readonly ScaledText text = new ScaledText(PointF.Empty, string.Empty, 0.35f); private float value = 100; private readonly List backgrounds = new List(); @@ -95,12 +97,12 @@ internal void SetColor(Color background, Color foreground) /// private void UpdateBars() { - SizeF @default = new SizeF(35, 9); + SizeF @default = new SizeF(barWidth, barHeight); // FIRST BAR if (value > 0 && value < 20) { - foregrounds[0].Size = new SizeF(@default.Width * (value / 20), @default.Height); + foregrounds[0].Size = new SizeF(barWidth * (value / 20), barHeight); } else { @@ -110,7 +112,7 @@ private void UpdateBars() // SECOND BAR if (value > 20 && value < 40) { - foregrounds[1].Size = new SizeF(@default.Width * ((value - 20) / 20), @default.Height); + foregrounds[1].Size = new SizeF(barWidth * ((value - 20) / 20), barHeight); } else { @@ -120,7 +122,7 @@ private void UpdateBars() // THIRD BAR if (value > 40 && value < 60) { - foregrounds[2].Size = new SizeF(@default.Width * ((value - 40) / 20), @default.Height); + foregrounds[2].Size = new SizeF(barWidth * ((value - 40) / 20), barHeight); } else { @@ -130,7 +132,7 @@ private void UpdateBars() // FOURTH BAR if (value > 60 && value < 80) { - foregrounds[3].Size = new SizeF(@default.Width * ((value - 60) / 20), @default.Height); + foregrounds[3].Size = new SizeF(barWidth * ((value - 60) / 20), barHeight); } else { @@ -140,7 +142,7 @@ private void UpdateBars() // FIFTH BAR if (value > 80 && value < 100) { - foregrounds[4].Size = new SizeF(@default.Width * ((value - 80) / 20), @default.Height); + foregrounds[4].Size = new SizeF(barWidth * ((value - 80) / 20), barHeight); } else { @@ -154,13 +156,19 @@ private void UpdateBars() /// The Width of the parent Stats Panel. public void Recalculate(PointF position, float width) { - text.Position = new PointF(position.X, position.Y); + const float barOffsetTop = 11; + const float offsetLeft = 9; + const float separatorSize = 4; + const float rightMargin = 42; + + text.Position = new PointF(position.X + offsetLeft, position.Y); for (int i = 0; i < 5; i++) { - PointF pos = new PointF(position.X + width - 234 + ((35 + 3) * i), position.Y + 10); + PointF pos = new PointF(position.X + width - rightMargin - (barWidth * (5 - i)) - (separatorSize * (5 - i)), position.Y + barOffsetTop); + backgrounds[i].Position = pos; - backgrounds[i].Size = new SizeF(35, 9); + backgrounds[i].Size = new SizeF(barWidth, barHeight); foregrounds[i].Position = pos; } diff --git a/LemonUI/Menus/NativeStatsPanel.cs b/LemonUI/Menus/NativeStatsPanel.cs index 97fa435e..7e82019a 100644 --- a/LemonUI/Menus/NativeStatsPanel.cs +++ b/LemonUI/Menus/NativeStatsPanel.cs @@ -1,4 +1,3 @@ -using LemonUI.Elements; using System; using System.Collections; using System.Collections.Generic; @@ -147,11 +146,15 @@ public override void Recalculate(PointF position, float width) { base.Recalculate(position, width); - Background.Size = new SizeF(width, (fields.Count * 38) + 9); + const float differenceTop = 7; + const float perStatSeparation = 38; + + Background.Size = new SizeF(width, differenceTop + (perStatSeparation * fields.Count)); for (int i = 0; i < fields.Count; i++) { - fields[i].Recalculate(new PointF(position.X + 9, position.Y + 9 + (38 * i)), width); + PointF fieldPosition = new PointF(position.X, position.Y + differenceTop + (perStatSeparation * i)); + fields[i].Recalculate(fieldPosition, width); } } ///