mirror of
https://github.com/GrahamKracker/UnityExplorer.git
synced 2025-01-10 10:59:36 +08:00
Hide TypeCompleter on suggestion chosen
This commit is contained in:
parent
34c8ad3646
commit
4019af5936
@ -29,6 +29,8 @@ namespace UnityExplorer.UI.Widgets.AutoComplete
|
|||||||
|
|
||||||
private HashSet<Type> allowedTypes;
|
private HashSet<Type> allowedTypes;
|
||||||
|
|
||||||
|
private string chosenSuggestion;
|
||||||
|
|
||||||
public TypeCompleter(Type baseType, InputFieldRef inputField)
|
public TypeCompleter(Type baseType, InputFieldRef inputField)
|
||||||
{
|
{
|
||||||
BaseType = baseType;
|
BaseType = baseType;
|
||||||
@ -52,14 +54,14 @@ namespace UnityExplorer.UI.Widgets.AutoComplete
|
|||||||
|
|
||||||
suggestions.Clear();
|
suggestions.Clear();
|
||||||
AutoCompleter.Instance.SetSuggestions(suggestions);
|
AutoCompleter.Instance.SetSuggestions(suggestions);
|
||||||
|
chosenSuggestion = suggestion.UnderlyingValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnInputFieldChanged(string value)
|
private void OnInputFieldChanged(string value)
|
||||||
{
|
{
|
||||||
value = value ?? "";
|
if (string.IsNullOrEmpty(value) || value == chosenSuggestion)
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(value))
|
|
||||||
{
|
{
|
||||||
|
chosenSuggestion = null;
|
||||||
AutoCompleter.Instance.ReleaseOwnership(this);
|
AutoCompleter.Instance.ReleaseOwnership(this);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user