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

View File

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