mirror of
https://github.com/ppy/osu.git
synced 2025-02-16 01:03:21 +08:00
Fix panel expanded state being updated multiple times unnecessarily
This commit is contained in:
parent
71e373ff51
commit
11f85779d5
@ -119,7 +119,10 @@ namespace osu.Game.Screens.Ranking
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
if (SelectedScore.Value == score)
|
if (SelectedScore.Value == score)
|
||||||
selectedScoreChanged(new ValueChangedEvent<ScoreInfo>(SelectedScore.Value, SelectedScore.Value));
|
{
|
||||||
|
if (IsLoaded)
|
||||||
|
SelectedScore.TriggerChange();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// We want the scroll position to remain relative to the expanded panel. When a new panel is added after the expanded panel, nothing needs to be done.
|
// We want the scroll position to remain relative to the expanded panel. When a new panel is added after the expanded panel, nothing needs to be done.
|
||||||
@ -143,11 +146,15 @@ namespace osu.Game.Screens.Ranking
|
|||||||
/// <param name="score">The <see cref="ScoreInfo"/> to present.</param>
|
/// <param name="score">The <see cref="ScoreInfo"/> to present.</param>
|
||||||
private void selectedScoreChanged(ValueChangedEvent<ScoreInfo> score)
|
private void selectedScoreChanged(ValueChangedEvent<ScoreInfo> score)
|
||||||
{
|
{
|
||||||
// Contract the old panel.
|
// avoid contracting panels unnecessarily when TriggerChange is fired manually.
|
||||||
foreach (var t in flow.Where(t => t.Panel.Score == score.OldValue))
|
if (score.OldValue != score.NewValue)
|
||||||
{
|
{
|
||||||
t.Panel.State = PanelState.Contracted;
|
// Contract the old panel.
|
||||||
t.Margin = new MarginPadding();
|
foreach (var t in flow.Where(t => t.Panel.Score == score.OldValue))
|
||||||
|
{
|
||||||
|
t.Panel.State = PanelState.Contracted;
|
||||||
|
t.Margin = new MarginPadding();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find the panel corresponding to the new score.
|
// Find the panel corresponding to the new score.
|
||||||
|
Loading…
Reference in New Issue
Block a user