Merge branch 'Visject-CommentRenameImprovementsTwo' of https://github.com/Chikinsupu/FlaxEngine into Chikinsupu-Visject-CommentRenameImprovementsTwo

This commit is contained in:
Wojtek Figat
2024-12-16 23:17:56 +01:00
2 changed files with 24 additions and 6 deletions

View File

@@ -1502,9 +1502,10 @@ namespace FlaxEditor.Surface.Archetypes
{
data = new object[]
{
filterText.Substring(2),
new Color(1.0f, 1.0f, 1.0f, 0.2f),
new Float2(400.0f, 400.0f),
filterText.Substring(2), // Title
new Color(1.0f, 1.0f, 1.0f, 0.2f), // Color
new Float2(400.0f, 400.0f), // Size
-1, // Order
};
return true;
}

View File

@@ -172,10 +172,21 @@ namespace FlaxEditor.Surface
/// <inheritdoc />
public override void Update(float deltaTime)
{
if (_isRenaming && (!_renameTextBox.IsFocused || !RootWindow.IsFocused))
if (_isRenaming)
{
Rename(_renameTextBox.Text);
StopRenaming();
// Stop renaming when clicking anywhere else
if (!_renameTextBox.IsFocused || !RootWindow.IsFocused)
{
Rename(_renameTextBox.Text);
StopRenaming();
}
}
else
{
if (IsSelected && Input.GetKeyDown(KeyboardKeys.F2))
{
StartRenaming();
}
}
base.Update(deltaTime);
@@ -417,6 +428,12 @@ namespace FlaxEditor.Surface
base.OnShowSecondaryContextMenu(menu, location);
menu.AddSeparator();
menu.AddButton("Rename", () =>
{
if(!_isRenaming)
StartRenaming();
});
ContextMenuChildMenu cmOrder = menu.AddChildMenu("Order");
{
cmOrder.ContextMenu.AddButton("Bring Forward", () =>