Merge pull request #12921 from peppy/fix-hud-offsets-out-of-bounds

Limit automatically calculated HUD offsets to keep menu items on screen
This commit is contained in:
Dan Balasescu 2021-05-24 17:25:03 +09:00 committed by GitHub
commit 28f91f8d65
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -196,12 +196,12 @@ namespace osu.Game.Screens.Play
}
if (lowestTopScreenSpace.HasValue)
topRightElements.Y = TopScoringElementsHeight = ToLocalSpace(lowestTopScreenSpace.Value).Y;
topRightElements.Y = TopScoringElementsHeight = MathHelper.Clamp(ToLocalSpace(lowestTopScreenSpace.Value).Y, 0, DrawHeight - topRightElements.DrawHeight);
else
topRightElements.Y = 0;
if (highestBottomScreenSpace.HasValue)
bottomRightElements.Y = BottomScoringElementsHeight = -(DrawHeight - ToLocalSpace(highestBottomScreenSpace.Value).Y);
bottomRightElements.Y = BottomScoringElementsHeight = -MathHelper.Clamp(DrawHeight - ToLocalSpace(highestBottomScreenSpace.Value).Y, 0, DrawHeight - bottomRightElements.DrawHeight);
else
bottomRightElements.Y = 0;
}