1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-05-10 11:28:44 +02:00

Automatically select the first element when a dropdown is opened in auto nav mode

This commit is contained in:
Ell 2022-03-10 13:50:47 +01:00
parent 67388c106b
commit cb8fed87e5
2 changed files with 8 additions and 0 deletions

View file

@ -45,6 +45,7 @@ Improvements
- Automatically update all elements when changing a ui system's viewport
- Allow setting a default color for clickable links in UiStyle
- Allow ElementHelper's KeybindButton to query a combination at a given index
- Automatically select the first element when a dropdown is opened in auto nav mode
Fixes
- Fixed paragraph links having incorrect hover locations when using special text alignments

View file

@ -22,6 +22,13 @@ namespace MLEM.Ui.Elements {
set {
this.Panel.IsHidden = !value;
this.OnOpenedOrClosed?.Invoke(this);
// select the first dropdown element in auto nav mode
if (value && this.Controls.IsAutoNavMode) {
var firstChild = this.Panel.GetChildren().FirstOrDefault(c => c.CanBeSelected);
if (firstChild != null)
this.Root.SelectElement(firstChild, true);
}
}
}
/// <summary>