From 23a72f2ade7ea1b2ceae88e83d2896d59560b3e4 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Wed, 6 Dec 2023 13:03:37 +0100 Subject: [PATCH] Fix not showing primary context menu on Visject surface if child control handled input event --- Source/Editor/Surface/VisjectSurface.Input.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Source/Editor/Surface/VisjectSurface.Input.cs b/Source/Editor/Surface/VisjectSurface.Input.cs index ec878a407..419c2d468 100644 --- a/Source/Editor/Surface/VisjectSurface.Input.cs +++ b/Source/Editor/Surface/VisjectSurface.Input.cs @@ -533,6 +533,7 @@ namespace FlaxEditor.Surface UpdateSelectionRectangle(); } } + bool showPrimaryMenu = false; if (_rightMouseDown && button == MouseButton.Right) { _rightMouseDown = false; @@ -546,8 +547,7 @@ namespace FlaxEditor.Surface _cmStartPos = location; if (controlUnderMouse == null) { - // Show primary context menu - ShowPrimaryMenu(_cmStartPos); + showPrimaryMenu = true; } } _mouseMoveAmount = 0; @@ -573,8 +573,13 @@ namespace FlaxEditor.Surface return true; } + // If none of the child controls handled this show the primary context menu + if (showPrimaryMenu) + { + ShowPrimaryMenu(_cmStartPos); + } // Letting go of a connection or right clicking while creating a connection - if (!_isMovingSelection && _connectionInstigator != null && !IsPrimaryMenuOpened) + else if (!_isMovingSelection && _connectionInstigator != null && !IsPrimaryMenuOpened) { _cmStartPos = location; Cursor = CursorType.Default;