Skip to content

Commit

Permalink
Merge pull request #25442 from bdach/argon-health-bar-sizing-broken
Browse files Browse the repository at this point in the history
Fix argon health bar not relative sizing correctly
  • Loading branch information
peppy authored Nov 14, 2023
2 parents 572ec91 + 83f8f03 commit 6e0375e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions osu.Game/Screens/Play/HUD/ArgonHealthDisplay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 6e0375e

Please sign in to comment.