Add **UI navigation** system

#574
This commit is contained in:
Wojciech Figat
2021-12-21 18:12:54 +01:00
parent 71212420f6
commit c178afdf6b
22 changed files with 918 additions and 54 deletions

View File

@@ -431,7 +431,6 @@ namespace FlaxEngine.GUI
_isMultiline = isMultiline;
_maxLength = 2147483646;
_selectionStart = _selectionEnd = -1;
AutoFocus = false;
var style = Style.Current;
CaretColor = style.Foreground;
@@ -1015,6 +1014,28 @@ namespace FlaxEngine.GUI
_isSelecting = false;
}
/// <inheritdoc />
public override void NavigationFocus()
{
base.NavigationFocus();
if (IsNavFocused)
SelectAll();
}
/// <inheritdoc />
public override void OnSubmit()
{
OnEditEnd();
if (IsNavFocused)
{
OnEditBegin();
SelectAll();
}
base.OnSubmit();
}
/// <inheritdoc />
public override void OnMouseMove(Vector2 location)
{
@@ -1215,7 +1236,8 @@ namespace FlaxEngine.GUI
SetSelection(-1);
_text = _onStartEditValue;
Defocus();
if (!IsNavFocused)
Defocus();
OnTextChanged();
return true;
@@ -1226,7 +1248,7 @@ namespace FlaxEngine.GUI
// Insert new line
Insert('\n');
}
else
else if (!IsNavFocused)
{
// End editing
Defocus();