|
|
@ -131,7 +131,10 @@ namespace Fungus.EditorUtils |
|
|
|
// Context Click occurs on MouseDown which interferes with panning |
|
|
|
// Context Click occurs on MouseDown which interferes with panning |
|
|
|
// Track right click positions manually to show menus on MouseUp |
|
|
|
// Track right click positions manually to show menus on MouseUp |
|
|
|
protected Vector2 rightClickDown = -Vector2.one; |
|
|
|
protected Vector2 rightClickDown = -Vector2.one; |
|
|
|
protected readonly float rightClickTolerance = 5f; |
|
|
|
protected const float rightClickTolerance = 5f; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected string searchString = string.Empty; |
|
|
|
|
|
|
|
protected const string searchFieldName = "search"; |
|
|
|
|
|
|
|
|
|
|
|
[MenuItem("Tools/Fungus/Flowchart Window")] |
|
|
|
[MenuItem("Tools/Fungus/Flowchart Window")] |
|
|
|
static void Init() |
|
|
|
static void Init() |
|
|
@ -268,6 +271,25 @@ namespace Fungus.EditorUtils |
|
|
|
} |
|
|
|
} |
|
|
|
deleteList.Clear(); |
|
|
|
deleteList.Clear(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Clear search filter focus |
|
|
|
|
|
|
|
if (Event.current.type == EventType.MouseDown) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
GUIUtility.keyboardControl = 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Escape) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (GUI.GetNameOfFocusedControl() == searchFieldName) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
searchString = string.Empty; |
|
|
|
|
|
|
|
GUIUtility.keyboardControl = 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else if (flowchart.SelectedBlocks.Count > 0) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
DeselectAll(flowchart); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
DrawFlowchartView(flowchart); |
|
|
|
DrawFlowchartView(flowchart); |
|
|
|
DrawOverlay(flowchart); |
|
|
|
DrawOverlay(flowchart); |
|
|
|
|
|
|
|
|
|
|
@ -318,6 +340,15 @@ namespace Fungus.EditorUtils |
|
|
|
|
|
|
|
|
|
|
|
GUILayout.FlexibleSpace(); |
|
|
|
GUILayout.FlexibleSpace(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GUI.SetNextControlName(searchFieldName); |
|
|
|
|
|
|
|
searchString = EditorGUILayout.TextField(searchString, GUI.skin.FindStyle("ToolbarSeachTextField"), GUILayout.Width(150)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (GUILayout.Button("", GUI.skin.FindStyle("ToolbarSeachCancelButton"))) // These are spelled correctly |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
searchString = string.Empty; |
|
|
|
|
|
|
|
GUIUtility.keyboardControl = 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
GUILayout.EndHorizontal(); |
|
|
|
GUILayout.EndHorizontal(); |
|
|
|
|
|
|
|
|
|
|
|
GUILayout.BeginHorizontal(); |
|
|
|
GUILayout.BeginHorizontal(); |
|
|
@ -1016,6 +1047,11 @@ namespace Fungus.EditorUtils |
|
|
|
var brightness = tintColor.r * 0.3 + tintColor.g * 0.59 + tintColor.b * 0.11; |
|
|
|
var brightness = tintColor.r * 0.3 + tintColor.g * 0.59 + tintColor.b * 0.11; |
|
|
|
nodeStyleCopy.normal.textColor = brightness >= 0.5 ? Color.black : Color.white; |
|
|
|
nodeStyleCopy.normal.textColor = brightness >= 0.5 ? Color.black : Color.white; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (searchString != string.Empty && !block.BlockName.ToLower().Contains(searchString.ToLower())) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
tintColor.a *= 0.2f; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
nodeStyleCopy.normal.background = offTex; |
|
|
|
nodeStyleCopy.normal.background = offTex; |
|
|
|
GUI.backgroundColor = tintColor; |
|
|
|
GUI.backgroundColor = tintColor; |
|
|
|
GUI.Box(boxRect, block.BlockName, nodeStyleCopy); |
|
|
|
GUI.Box(boxRect, block.BlockName, nodeStyleCopy); |
|
|
@ -1293,7 +1329,7 @@ namespace Fungus.EditorUtils |
|
|
|
Event.current.Use(); |
|
|
|
Event.current.Use(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
else if (c == "SelectAll") |
|
|
|
else if (c == "SelectAll" || c == "Find") |
|
|
|
{ |
|
|
|
{ |
|
|
|
Event.current.Use(); |
|
|
|
Event.current.Use(); |
|
|
|
} |
|
|
|
} |
|
|
@ -1340,6 +1376,10 @@ namespace Fungus.EditorUtils |
|
|
|
} |
|
|
|
} |
|
|
|
Event.current.Use(); |
|
|
|
Event.current.Use(); |
|
|
|
break; |
|
|
|
break; |
|
|
|
|
|
|
|
case "Find": |
|
|
|
|
|
|
|
EditorGUI.FocusTextInControl(searchFieldName); |
|
|
|
|
|
|
|
Event.current.Use(); |
|
|
|
|
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|