From 83f8f03c7e3b173766e9c715bd7869929082600b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= <dach.bartlomiej@gmail.com>
Date: Tue, 14 Nov 2023 21:46:57 +0900
Subject: [PATCH] Fix argon health bar not relative sizing correctly

---
 osu.Game/Screens/Play/HUD/ArgonHealthDisplay.cs | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/osu.Game/Screens/Play/HUD/ArgonHealthDisplay.cs b/osu.Game/Screens/Play/HUD/ArgonHealthDisplay.cs
index f4ce7d16334a..4a5faafd8b29 100644
--- a/osu.Game/Screens/Play/HUD/ArgonHealthDisplay.cs
+++ b/osu.Game/Screens/Play/HUD/ArgonHealthDisplay.cs
@@ -141,7 +141,13 @@ protected override void LoadComplete()
 
             Current.BindValueChanged(_ => Scheduler.AddOnce(updateCurrent), true);
 
+            // we're about to set `RelativeSizeAxes` depending on the value of `UseRelativeSize`.
+            // setting `RelativeSizeAxes` internally transforms absolute sizing to relative and back to keep the size the same,
+            // but that is not what we want in this case, since the width at this point is valid in the *target* sizing mode.
+            // to counteract this, store the numerical value here, and restore it after setting the correct initial relative sizing axes.
+            float previousWidth = Width;
             UseRelativeSize.BindValueChanged(v => RelativeSizeAxes = v.NewValue ? Axes.X : Axes.None, true);
+            Width = previousWidth;
 
             BarHeight.BindValueChanged(_ => updatePath(), true);
         }