Fix case when child context menu is already hidden and changed to other from code

This commit is contained in:
Wojtek Figat
2023-01-01 21:42:35 +01:00
parent 4afa59a783
commit bc7bf72660

View File

@@ -356,10 +356,15 @@ namespace FlaxEditor.GUI.ContextMenu
private void OnWindowGotFocus()
{
if (_childCM != null && _window && _window.IsForegroundWindow)
var child = _childCM;
if (child != null && _window && _window.IsForegroundWindow)
{
// Hide child if user clicked over parent (do it next frame to process other events before - eg. child windows focus loss)
FlaxEngine.Scripting.InvokeOnUpdate(HideChild);
FlaxEngine.Scripting.InvokeOnUpdate(() =>
{
if (child == _childCM)
HideChild();
});
}
}