diff --git a/Assets/Fungus/Scripts/Editor/BasePopupWindowContent.cs b/Assets/Fungus/Scripts/Editor/BasePopupWindowContent.cs
index 3073d7d3..786c95ec 100644
--- a/Assets/Fungus/Scripts/Editor/BasePopupWindowContent.cs
+++ b/Assets/Fungus/Scripts/Editor/BasePopupWindowContent.cs
@@ -20,27 +20,34 @@ namespace Fungus.EditorUtils
abstract protected void SelectByOrigIndex(int index);
///
- /// Called during Base Ctor, so that all
+ /// Called during Base Ctor, must fill allItems list so the ctor can continue to fill
+ /// the visible items and current selected index.
///
abstract protected void PrepareAllItems();
+ ///
+ /// Internal representation of 1 row of our popup list
+ ///
public class FilteredListItem
{
- public FilteredListItem(int index, string str)
+ public FilteredListItem(int index, string str, string tip = "")
{
origIndex = index;
name = str;
lowerName = str.ToLowerInvariant();
+ content = new GUIContent(str, tip);
}
public int origIndex;
public string name, lowerName;
+ public GUIContent content;
}
protected Block block;
protected int hoverIndex;
protected readonly string SEARCH_CONTROL_NAME = "PopupSearchControlName";
protected readonly float ROW_HEIGHT = EditorGUIUtility.singleLineHeight;
- protected List allItems = new List(), visibleItems = new List();
+ protected List allItems = new List(),
+ visibleItems = new List();
protected string currentFilter = string.Empty;
protected Vector2 scroll;
protected int scrollToIndex;
@@ -57,9 +64,10 @@ namespace Fungus.EditorUtils
PrepareAllItems();
- allItems.Sort((lhs, rhs) => lhs.name.CompareTo(rhs.name));
+ allItems.Sort((lhs, rhs) => lhs.lowerName.CompareTo(rhs.lowerName));
UpdateFilter();
currentIndex = Mathf.Max(0, visibleItems.FindIndex(x=>x.name.Contains(currentHandlerName)));
+ hoverIndex = currentIndex;
}
public override void OnGUI(Rect rect)
@@ -153,7 +161,16 @@ namespace Fungus.EditorUtils
{
if (Event.current.type == EventType.MouseMove ||
Event.current.type == EventType.ScrollWheel)
+ {
+ //if new item force update so it's snappier
+ if (hoverIndex != 1)
+ {
+ this.editorWindow.Repaint();
+ }
+
hoverIndex = i;
+ }
+
if (Event.current.type == EventType.MouseDown)
{
//onSelectionMade(list.Entries[i].Index);
@@ -188,7 +205,7 @@ namespace Fungus.EditorUtils
Rect labelRect = new Rect(rowRect);
//labelRect.xMin += ROW_INDENT;
- GUI.Label(labelRect, visibleItems[i].name);
+ GUI.Label(labelRect, visibleItems[i].content);
}
///
@@ -231,11 +248,11 @@ namespace Fungus.EditorUtils
}
- protected void SelectByName(string name)
- {
- var loc = allItems.FindIndex(x => x.name == name);
- SelectByOrigIndex(loc);
- }
+ //protected void SelectByName(string name)
+ //{
+ // var loc = allItems.FindIndex(x => x.name == name);
+ // SelectByOrigIndex(loc);
+ //}
}
}
\ No newline at end of file
diff --git a/Assets/Fungus/Scripts/Editor/CommandSelectorPopupWindowContent.cs b/Assets/Fungus/Scripts/Editor/CommandSelectorPopupWindowContent.cs
index 00f34d3f..4f2b41a2 100644
--- a/Assets/Fungus/Scripts/Editor/CommandSelectorPopupWindowContent.cs
+++ b/Assets/Fungus/Scripts/Editor/CommandSelectorPopupWindowContent.cs
@@ -58,7 +58,7 @@ namespace Fungus.EditorUtils
int i = 0;
foreach (var item in filteredAttributes)
{
- allItems.Add(new FilteredListItem(i, (item.Value.Category.Length > 0 ? item.Value.Category + "/" : "") + item.Value.CommandName));
+ allItems.Add(new FilteredListItem(i, (item.Value.Category.Length > 0 ? item.Value.Category + "/" : "") + item.Value.CommandName, item.Value.HelpText));
i++;
}
diff --git a/Assets/Fungus/Scripts/Editor/EventSelectorPopupWindowContent.cs b/Assets/Fungus/Scripts/Editor/EventSelectorPopupWindowContent.cs
index 2956ddef..77d5faf1 100644
--- a/Assets/Fungus/Scripts/Editor/EventSelectorPopupWindowContent.cs
+++ b/Assets/Fungus/Scripts/Editor/EventSelectorPopupWindowContent.cs
@@ -51,11 +51,11 @@ namespace Fungus.EditorUtils
EventHandlerInfoAttribute info = EventHandlerEditor.GetEventHandlerInfo(type);
if (info != null)
{
- allItems.Add(new FilteredListItem(i, (info.Category.Length > 0 ? info.Category + "/" : "") + info.EventHandlerName));
+ allItems.Add(new FilteredListItem(i, (info.Category.Length > 0 ? info.Category + "/" : "") + info.EventHandlerName, info.HelpText));
}
else
{
- allItems.Add(new FilteredListItem(i, type.Name));
+ allItems.Add(new FilteredListItem(i, type.Name, info.HelpText));
}
i++;