From 60f9bc5fd2e57758c4dd44d5d2ce78aa875adfb2 Mon Sep 17 00:00:00 2001 From: Zach Vinless Date: Tue, 8 Nov 2016 20:54:14 -0800 Subject: [PATCH] Added tolerance value for right click MouseUp context clicks --- Assets/Fungus/Scripts/Editor/FlowchartWindow.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Assets/Fungus/Scripts/Editor/FlowchartWindow.cs b/Assets/Fungus/Scripts/Editor/FlowchartWindow.cs index 5de4942c..9c49352f 100644 --- a/Assets/Fungus/Scripts/Editor/FlowchartWindow.cs +++ b/Assets/Fungus/Scripts/Editor/FlowchartWindow.cs @@ -42,6 +42,7 @@ namespace Fungus.EditorUtils // Context Click occurs on MouseDown which interferes with panning // Track right click positions manually to show menus on MouseUp protected Vector2 rightClickDown = -Vector2.one; + protected readonly float rightClickTolerance = 5f; [MenuItem("Tools/Fungus/Flowchart Window")] static void Init() @@ -310,7 +311,10 @@ namespace Fungus.EditorUtils } else if (Event.current.type == EventType.MouseDrag) { - rightClickDown = -Vector2.one; + if (Vector2.Distance(rightClickDown, Event.current.mousePosition) > rightClickTolerance) + { + rightClickDown = -Vector2.one; + } } } @@ -487,7 +491,7 @@ namespace Fungus.EditorUtils // Handle right click up outside of EditorZoomArea to avoid strange offsets if (Event.current.type == EventType.MouseUp && Event.current.button == 1 && - Event.current.mousePosition == rightClickDown && !mouseOverVariables) + rightClickDown != -Vector2.one && !mouseOverVariables) { var menu = new GenericMenu(); var mousePosition = rightClickDown;