1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-11-26 06:28:35 +01:00

Fixed dropdowns with some non-selectable children failing to navigate when using gamepad controls

This commit is contained in:
Ell 2022-03-17 20:46:49 +01:00
parent 1f4f0cfa44
commit c5b2b8798e
2 changed files with 3 additions and 2 deletions

View file

@ -62,6 +62,7 @@ Fixes
- Fixed buttons and checkboxes changing their CanBeSelected and CanBePressed values when being disabled - Fixed buttons and checkboxes changing their CanBeSelected and CanBePressed values when being disabled
- Fixed children of Panel scroll bars also being scrolled - Fixed children of Panel scroll bars also being scrolled
- Fixed RootElement.CanSelectContent and Element.IsSelected returning incorrect results when CanBeSelected changes - Fixed RootElement.CanSelectContent and Element.IsSelected returning incorrect results when CanBeSelected changes
- Fixed dropdowns with some non-selectable children failing to navigate when using gamepad controls
Removals Removals
- Marked StyleProp equality members as obsolete - Marked StyleProp equality members as obsolete

View file

@ -63,10 +63,10 @@ namespace MLEM.Ui.Elements {
if (dir == Direction2.Left || dir == Direction2.Right) if (dir == Direction2.Left || dir == Direction2.Right)
return null; return null;
if (dir == Direction2.Up) { if (dir == Direction2.Up) {
var prev = element.GetOlderSibling(); var prev = element.GetOlderSibling(e => e.CanBeSelected);
return prev ?? this; return prev ?? this;
} else if (dir == Direction2.Down) { } else if (dir == Direction2.Down) {
return element.GetSiblings(e => e.GetOlderSibling() == element).FirstOrDefault(); return element.GetSiblings(e => e.CanBeSelected && e.GetOlderSibling(s => s.CanBeSelected) == element).FirstOrDefault();
} }
return usualNext; return usualNext;
}; };