1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 20:45:46 +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

@ -328,25 +328,31 @@ 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)
{ {
if (panel == null) try
panel = group.BeatmapPanels.First(); {
if (panel == null)
panel = group.BeatmapPanels.First();
if (selectedPanel == panel) return; if (selectedPanel == panel) return;
Trace.Assert(group.BeatmapPanels.Contains(panel), @"Selected panel must be in provided group"); Trace.Assert(group.BeatmapPanels.Contains(panel), @"Selected panel must be in provided group");
if (selectedGroup != null && selectedGroup != group && selectedGroup.State != BeatmapGroupState.Hidden) if (selectedGroup != null && selectedGroup != group && selectedGroup.State != BeatmapGroupState.Hidden)
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)