diff --git a/Assets/SEE/Controls/Actions/ContextMenuAction.cs b/Assets/SEE/Controls/Actions/ContextMenuAction.cs
index a55fd6fad9..d821754c0a 100644
--- a/Assets/SEE/Controls/Actions/ContextMenuAction.cs
+++ b/Assets/SEE/Controls/Actions/ContextMenuAction.cs
@@ -27,6 +27,11 @@ public class ContextMenuAction : MonoBehaviour
///
private PopupMenu popupMenu;
+ ///
+ /// The position of the mouse when the user started opening the context menu.
+ ///
+ private Vector3 startMousePosition = Vector3.zero;
+
private void Start()
{
popupMenu = gameObject.AddComponent();
@@ -34,7 +39,11 @@ private void Start()
private void Update()
{
- if (SEEInput.OpenContextMenu())
+ if (SEEInput.OpenContextMenuStart())
+ {
+ startMousePosition = Input.mousePosition;
+ }
+ else if (SEEInput.OpenContextMenuEnd() && (Input.mousePosition - startMousePosition).magnitude < 1)
{
// TODO (#664): Detect if multiple elements are selected and adjust options accordingly.
HitGraphElement hit = Raycasting.RaycastInteractableObject(out _, out InteractableObject o);
diff --git a/Assets/SEE/Controls/SEEInput.cs b/Assets/SEE/Controls/SEEInput.cs
index 21d5c28d4a..42f7d1366f 100644
--- a/Assets/SEE/Controls/SEEInput.cs
+++ b/Assets/SEE/Controls/SEEInput.cs
@@ -243,10 +243,19 @@ public static bool ToggleMetricHoveringSelection()
//-----------------------------------------------------
///
- /// True if the user wants to open the context menu.
+ /// True if the user starts the mouse interaction to open the context menu.
///
- /// True if the user wants to open the context menu.
- internal static bool OpenContextMenu()
+ /// true if the user starts the mouse interaction to open the context menu
+ internal static bool OpenContextMenuStart()
+ {
+ return Input.GetMouseButtonDown(rightMouseButton) && !Raycasting.IsMouseOverGUI();
+ }
+
+ ///
+ /// True if the user ends the mouse interaction to open the context menu.
+ ///
+ /// true if the user ends the mouse interaction to open the context menu
+ internal static bool OpenContextMenuEnd()
{
return Input.GetMouseButtonUp(rightMouseButton) && !Raycasting.IsMouseOverGUI();
}