mirror of
https://github.com/ppy/osu.git
synced 2026-05-19 04:11:29 +08:00
Fix keyboard selection being reset/invalidated more often than required
This commit is contained in:
@@ -113,14 +113,21 @@ namespace osu.Game.Graphics.Carousel
|
||||
if (currentSelection.Model != null)
|
||||
HandleItemDeselected(currentSelection.Model);
|
||||
|
||||
currentKeyboardSelection = new Selection(value);
|
||||
currentSelection = currentKeyboardSelection;
|
||||
currentSelection = new Selection(value);
|
||||
currentKeyboardSelection = currentSelection;
|
||||
selectionValid.Invalidate();
|
||||
}
|
||||
else if (currentKeyboardSelection.Model != value)
|
||||
|
||||
// Check keyboard selection equality separately.
|
||||
//
|
||||
// If current selection set to an already-selected value, we want to ensure
|
||||
// that keyboard selection (which basically represents the "visual" tracking of selection)
|
||||
// is still reset back to the newly set value.
|
||||
//
|
||||
// The main case this handles is when a set header is clicked and we want to make sure one of its
|
||||
// "children" are re-selected.
|
||||
if (!CheckModelEquality(currentKeyboardSelection.Model, value))
|
||||
{
|
||||
// Even if the current selection matches, let's ensure the keyboard selection is reset
|
||||
// to the newly selected object. This matches user expectations (for now).
|
||||
currentKeyboardSelection = currentSelection;
|
||||
selectionValid.Invalidate();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user