From eab45f0c4884e162dc3ba7c2a69901a4d4241587 Mon Sep 17 00:00:00 2001 From: Chandler Cox Date: Fri, 11 Nov 2022 12:42:12 -0600 Subject: [PATCH] renames item when clicking off of the popup and name is changed --- Source/Editor/GUI/Popups/RenamePopup.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Source/Editor/GUI/Popups/RenamePopup.cs b/Source/Editor/GUI/Popups/RenamePopup.cs index 891ced9c7..0e21f331b 100644 --- a/Source/Editor/GUI/Popups/RenamePopup.cs +++ b/Source/Editor/GUI/Popups/RenamePopup.cs @@ -81,6 +81,20 @@ namespace FlaxEditor.GUI private bool IsInputValid => !string.IsNullOrWhiteSpace(_inputField.Text) && (_inputField.Text == _startValue || Validate == null || Validate(this, _inputField.Text)); + /// + public override void Update(float deltaTime) + { + var mouseLocation = Root.MousePosition; + if (!ContainsPoint(ref mouseLocation) && RootWindow.ContainsFocus && Text != _startValue) + { + // rename item before closing if left mouse button in clicked + if (FlaxEngine.Input.GetMouseButton(MouseButton.Left)) + OnEnd(); + } + + base.Update(deltaTime); + } + private void OnTextChanged() { if (Validate == null)