mirror of
https://github.com/GrahamKracker/UnityExplorer.git
synced 2025-01-09 18:48:46 +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 string chosenSuggestion;
|
||||
|
||||
public TypeCompleter(Type baseType, InputFieldRef inputField)
|
||||
{
|
||||
BaseType = baseType;
|
||||
@ -52,14 +54,14 @@ namespace UnityExplorer.UI.Widgets.AutoComplete
|
||||
|
||||
suggestions.Clear();
|
||||
AutoCompleter.Instance.SetSuggestions(suggestions);
|
||||
chosenSuggestion = suggestion.UnderlyingValue;
|
||||
}
|
||||
|
||||
private void OnInputFieldChanged(string value)
|
||||
{
|
||||
value = value ?? "";
|
||||
|
||||
if (string.IsNullOrEmpty(value))
|
||||
if (string.IsNullOrEmpty(value) || value == chosenSuggestion)
|
||||
{
|
||||
chosenSuggestion = null;
|
||||
AutoCompleter.Instance.ReleaseOwnership(this);
|
||||
}
|
||||
else
|
||||
|
Loading…
x
Reference in New Issue
Block a user