1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 22:22:55 +08:00

Fix regression in panel select animation.

Currently we are required to update computeYPositions twice per selection. Without doing this, panels are in the wrong place when using keyboard selection.

There's still a bit of work to be done to make this work correctly. It's caused by a race condition of state application for panels which have not yet been presented (and get their state applied in LoadComplete which breaks the order of things).
This commit is contained in:
Dean Herbert 2017-04-28 22:17:35 +09:00
parent 70e81115f4
commit 4e65da0fd1

View File

@ -327,6 +327,8 @@ namespace osu.Game.Screens.Select
} }
private void selectGroup(BeatmapGroup group, BeatmapPanel panel = null, bool animated = true) private void selectGroup(BeatmapGroup group, BeatmapPanel panel = null, bool animated = true)
{
try
{ {
if (panel == null) if (panel == null)
panel = group.BeatmapPanels.First(); panel = group.BeatmapPanels.First();
@ -339,15 +341,19 @@ namespace osu.Game.Screens.Select
selectedGroup.State = BeatmapGroupState.Collapsed; selectedGroup.State = BeatmapGroupState.Collapsed;
group.State = BeatmapGroupState.Expanded; group.State = BeatmapGroupState.Expanded;
selectedGroup = group;
panel.State = PanelSelectedState.Selected; panel.State = PanelSelectedState.Selected;
selectedPanel = panel;
float selectedY = computeYPositions(animated); selectedPanel = panel;
ScrollTo(selectedY, animated); selectedGroup = group;
SelectionChanged?.Invoke(panel.Beatmap); SelectionChanged?.Invoke(panel.Beatmap);
} }
finally
{
float selectedY = computeYPositions(animated);
ScrollTo(selectedY, animated);
}
}
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
{ {