1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 12:33:01 +08:00

Polish a few extreme edge cases

This commit is contained in:
Bartłomiej Dach 2023-05-25 16:39:54 +02:00
parent beeca5a8dd
commit 3ad5f8b9c9
No known key found for this signature in database

View File

@ -376,7 +376,12 @@ namespace osu.Game.Screens.Edit.Compose.Components
float leftExcess = thisQuad.TopLeft.X - parentQuad.TopLeft.X;
float rightExcess = parentQuad.TopRight.X - thisQuad.TopRight.X;
if (topExcess > bottomExcess)
if (topExcess + bottomExcess < buttons.Height + button_padding)
{
buttons.Anchor = Anchor.BottomCentre;
buttons.Origin = Anchor.BottomCentre;
}
else if (topExcess > bottomExcess)
{
buttons.Anchor = Anchor.TopCentre;
buttons.Origin = Anchor.BottomCentre;
@ -387,8 +392,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
buttons.Origin = Anchor.TopCentre;
}
if (leftExcess < 0) buttons.X += ToLocalSpace(thisQuad.TopLeft - new Vector2(leftExcess)).X;
if (rightExcess < 0) buttons.X += ToLocalSpace(thisQuad.TopLeft + new Vector2(rightExcess)).X;
buttons.X += ToLocalSpace(thisQuad.TopLeft - new Vector2(Math.Min(0, leftExcess)) + new Vector2(Math.Min(0, rightExcess))).X;
}
}
}