From eab45f0c4884e162dc3ba7c2a69901a4d4241587 Mon Sep 17 00:00:00 2001 From: Chandler Cox Date: Fri, 11 Nov 2022 12:42:12 -0600 Subject: [PATCH 1/2] 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) From 6c18ca3f454cdc6bd41c42ac17283aa8535f7f4d Mon Sep 17 00:00:00 2001 From: Chandler Cox Date: Fri, 11 Nov 2022 12:45:10 -0600 Subject: [PATCH 2/2] changed to MouseButtonDown --- Source/Editor/GUI/Popups/RenamePopup.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Editor/GUI/Popups/RenamePopup.cs b/Source/Editor/GUI/Popups/RenamePopup.cs index 0e21f331b..01fbdc03f 100644 --- a/Source/Editor/GUI/Popups/RenamePopup.cs +++ b/Source/Editor/GUI/Popups/RenamePopup.cs @@ -88,7 +88,7 @@ namespace FlaxEditor.GUI if (!ContainsPoint(ref mouseLocation) && RootWindow.ContainsFocus && Text != _startValue) { // rename item before closing if left mouse button in clicked - if (FlaxEngine.Input.GetMouseButton(MouseButton.Left)) + if (FlaxEngine.Input.GetMouseButtonDown(MouseButton.Left)) OnEnd(); }