Merge pull request #30535 from bdach/fix-hud-shifting-when-flipped-drawables-present

Fix HUD elements shifting in unintended manner when partially off-screen flipped skin elements are present
This commit is contained in:
Dan Balasescu 2024-11-08 01:55:03 +09:00 committed by GitHub
commit 8bd65d9938
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 2 deletions

View File

@ -300,7 +300,9 @@ void processDrawable(ISerialisableDrawable element)
if (element is LegacyHealthDisplay)
return;
float bottom = drawable.ScreenSpaceDrawQuad.BottomRight.Y;
// AABB is used here because the drawable can be flipped/rotated arbitrarily,
// so the "bottom right" corner of the raw SSDQ might not necessarily be where one expects it to be.
float bottom = drawable.ScreenSpaceDrawQuad.AABBFloat.BottomRight.Y;
bool isRelativeX = drawable.RelativeSizeAxes == Axes.X;
@ -319,7 +321,7 @@ void processDrawable(ISerialisableDrawable element)
// and align bottom-right components with the top-edge of the highest bottom-anchored hud element.
else if (drawable.Anchor.HasFlag(Anchor.BottomRight) || (drawable.Anchor.HasFlag(Anchor.y2) && drawable.RelativeSizeAxes == Axes.X))
{
var topLeft = element.ScreenSpaceDrawQuad.TopLeft;
var topLeft = element.ScreenSpaceDrawQuad.AABBFloat.TopLeft;
if (highestBottomScreenSpace == null || topLeft.Y < highestBottomScreenSpace.Value.Y)
highestBottomScreenSpace = topLeft;
}