Browse Source

Added tolerance value for right click MouseUp context clicks

master
Zach Vinless 8 years ago
parent
commit
60f9bc5fd2
  1. 6
      Assets/Fungus/Scripts/Editor/FlowchartWindow.cs

6
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()
@ -309,10 +310,13 @@ namespace Fungus.EditorUtils
rightClickDown = Event.current.mousePosition;
}
else if (Event.current.type == EventType.MouseDrag)
{
if (Vector2.Distance(rightClickDown, Event.current.mousePosition) > rightClickTolerance)
{
rightClickDown = -Vector2.one;
}
}
}
EditorZoomArea.Begin(flowchart.Zoom, scriptViewRect);
@ -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;

Loading…
Cancel
Save