1
0
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:
Dean Herbert
2025-08-12 03:13:59 +09:00
Unverified
parent 9615a82380
commit 71d8873cb3
+12 -5
View File
@@ -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();
}