Skip to content

Commit

Permalink
- Added the ability to rename selected visject comments by pressing F2
Browse files Browse the repository at this point in the history
- Added rename option to context menu for visject comments
  • Loading branch information
Chikinsupu committed Dec 7, 2024
1 parent 0cf3139 commit 82453ac
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions Source/Editor/Surface/SurfaceComment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,21 @@ protected override void UpdateRectangles()
/// <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);
Expand Down Expand Up @@ -417,6 +428,12 @@ public override void OnShowSecondaryContextMenu(FlaxEditor.GUI.ContextMenu.Conte
base.OnShowSecondaryContextMenu(menu, location);

menu.AddSeparator();
menu.AddButton("Rename", () =>
{
if(!_isRenaming)
StartRenaming();
});

ContextMenuChildMenu cmOrder = menu.AddChildMenu("Order");
{
cmOrder.ContextMenu.AddButton("Bring Forward", () =>
Expand Down

0 comments on commit 82453ac

Please sign in to comment.