From cd1885a17bbec36fecf2117910f4a8e4c0add095 Mon Sep 17 00:00:00 2001 From: outfoxxed Date: Sun, 16 Oct 2022 02:55:10 -0700 Subject: [PATCH] Fix hit error bar icon orientation Icons now keep their original orientation when the hit error bar is flipped --- .../HUD/HitErrorMeters/BarHitErrorMeter.cs | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Play/HUD/HitErrorMeters/BarHitErrorMeter.cs b/osu.Game/Screens/Play/HUD/HitErrorMeters/BarHitErrorMeter.cs index 747f4d4a8a..9687952fff 100644 --- a/osu.Game/Screens/Play/HUD/HitErrorMeters/BarHitErrorMeter.cs +++ b/osu.Game/Screens/Play/HUD/HitErrorMeters/BarHitErrorMeter.cs @@ -338,8 +338,26 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters base.Update(); // undo any layout rotation to display icons in the correct orientation - if (labelEarly != null) labelEarly.Rotation = -Rotation; - if (labelLate != null) labelLate.Rotation = -Rotation; + bool xFlipped = Scale.X < 0; + bool yFlipped = Scale.Y < 0; + bool horizontal = Rotation == 90 || Rotation == -90; + + bool flipX = (xFlipped && yFlipped) || (xFlipped && !horizontal) || (yFlipped && horizontal); + bool flipY = (xFlipped && yFlipped) || (xFlipped && horizontal) || (yFlipped && !horizontal); + + Vector2 flipScale = new Vector2(flipX ? -1 : 1, flipY ? -1 : 1); + + if (labelEarly != null) + { + labelEarly.Rotation = -Rotation; + labelEarly.Scale = flipScale; + } + + if (labelLate != null) + { + labelLate.Rotation = -Rotation; + labelLate.Scale = flipScale; + } } private void createColourBars((HitResult result, double length)[] windows)