1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 18:47:27 +08:00

Fix placing new match via right click not using original click position

This commit is contained in:
Dean Herbert 2023-07-28 16:29:39 +09:00
parent b5f0d739e6
commit b5c3e2a648

View File

@ -76,6 +76,14 @@ namespace osu.Game.Tournament.Screens.Editors
grid.Size = ScrollContent.Size + new Vector2(GRID_SPACING * 2);
}
private Vector2 lastMatchesContainerMouseDownPosition;
protected override bool OnMouseDown(MouseDownEvent e)
{
lastMatchesContainerMouseDownPosition = MatchesContainer.ToLocalSpace(e.ScreenSpaceMouseDownPosition);
return base.OnMouseDown(e);
}
private void updateMessage()
{
rightClickMessage.Alpha = LadderInfo.Matches.Count > 0 ? 0 : 1;
@ -97,7 +105,8 @@ namespace osu.Game.Tournament.Screens.Editors
{
new OsuMenuItem("Create new match", MenuItemType.Highlighted, () =>
{
Vector2 pos = MatchesContainer.ToLocalSpace(GetContainingInputManager().CurrentState.Mouse.Position);
Vector2 pos = lastMatchesContainerMouseDownPosition;
TournamentMatch newMatch = new TournamentMatch { Position = { Value = new Point((int)pos.X, (int)pos.Y) } };
LadderInfo.Matches.Add(newMatch);