remove create new script items when searchbox is cleared
This commit is contained in:
@@ -70,7 +70,7 @@ namespace FlaxEditor.CustomEditors.Dedicated
|
|||||||
var buttonHeight = (textSize.Y < 18) ? 18 : textSize.Y + 4;
|
var buttonHeight = (textSize.Y < 18) ? 18 : textSize.Y + 4;
|
||||||
_addScriptsButton = new Button
|
_addScriptsButton = new Button
|
||||||
{
|
{
|
||||||
TooltipText = "Add new scripts to the actor",
|
TooltipText = "Add new scripts to the actor.",
|
||||||
AnchorPreset = AnchorPresets.MiddleCenter,
|
AnchorPreset = AnchorPresets.MiddleCenter,
|
||||||
Text = buttonText,
|
Text = buttonText,
|
||||||
Parent = this,
|
Parent = this,
|
||||||
@@ -114,7 +114,16 @@ namespace FlaxEditor.CustomEditors.Dedicated
|
|||||||
cm.TextChanged += text =>
|
cm.TextChanged += text =>
|
||||||
{
|
{
|
||||||
if (!IsValidScriptName(text))
|
if (!IsValidScriptName(text))
|
||||||
|
{
|
||||||
|
// Remove NewScriptItems
|
||||||
|
List<Control> die = cm.ItemsPanel.Children.FindAll(c => c is NewScriptItem);
|
||||||
|
foreach (var c in die)
|
||||||
|
{
|
||||||
|
cm.ItemsPanel.RemoveChild(c);
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
if (!cm.ItemsPanel.Children.Any(x => x.Visible && x is not NewScriptItem))
|
if (!cm.ItemsPanel.Children.Any(x => x.Visible && x is not NewScriptItem))
|
||||||
{
|
{
|
||||||
// If there are no visible items, that means the search failed so we can find the create script button or create one if it's the first time
|
// If there are no visible items, that means the search failed so we can find the create script button or create one if it's the first time
|
||||||
@@ -876,7 +885,7 @@ namespace FlaxEditor.CustomEditors.Dedicated
|
|||||||
// Add drag button to the group
|
// Add drag button to the group
|
||||||
var scriptDrag = new DragImage
|
var scriptDrag = new DragImage
|
||||||
{
|
{
|
||||||
TooltipText = "Script reference",
|
TooltipText = "Script reference.",
|
||||||
AutoFocus = true,
|
AutoFocus = true,
|
||||||
IsScrollable = false,
|
IsScrollable = false,
|
||||||
Color = FlaxEngine.GUI.Style.Current.ForegroundGrey,
|
Color = FlaxEngine.GUI.Style.Current.ForegroundGrey,
|
||||||
|
|||||||
Reference in New Issue
Block a user