1.8.4: History received a fix for startup issue, increased entry size, and context menu options

- Set selection active in history is now a toggleable feature in the context menu
- Increased number of entries in history from 32 to 64
- Clear entries moved to context menu in history
- Fixed issue, where history didn't work on first startup
This commit is contained in:
Anders Ejlersen 2023-03-27 22:02:44 +02:00
parent 305aa13317
commit 5a2dcf3619
17 changed files with 141 additions and 86 deletions

View file

@ -11,17 +11,17 @@ namespace Module.NavigationTool.Editor.History
private Vector2 scrollPosition;
[NonSerialized]
private HistoryList historyList;
private EditorHistoryList editorHistoryList;
public override void Initialize()
{
historyList = HistoryUtility.GetHistoryList();
editorHistoryList = EditorHistoryUtility.GetHistoryList();
}
public override void Draw(EditorHistoryWindow window, Rect rect, Styles styles)
{
float entryHeight = EditorGUIUtility.singleLineHeight;
float height = entryHeight * historyList.entries.Count;
float height = entryHeight * editorHistoryList.entries.Count;
bool isSearching = !string.IsNullOrEmpty(window.viewTools.searchStr);
string lowerSearchStr = window.viewTools.searchStr.ToLower();
@ -34,14 +34,14 @@ namespace Module.NavigationTool.Editor.History
scrollPosition = GUI.BeginScrollView(position, scrollPosition, viewRect);
{
for (int i = historyList.entries.Count - 1; i >= 0; i--)
for (int i = editorHistoryList.entries.Count - 1; i >= 0; i--)
{
HistoryList.Entry e = historyList.entries[i];
EditorHistoryList.Entry e = editorHistoryList.entries[i];
if (isSearching && !e.lowerName.Contains(lowerSearchStr))
continue;
HistoryGUIUtility.DrawEntry(entryRect, historyList.entries[i], styles, true);
EditorHistoryGUIUtility.DrawEntry(entryRect, editorHistoryList.entries[i], styles, true);
entryRect.y += entryHeight;
}
}

View file

@ -8,27 +8,28 @@ namespace Module.NavigationTool.Editor.History
internal sealed class EditorHistoryViewTools : AbstractEditorHistoryView
{
public string searchStr = string.Empty;
[NonSerialized]
private HistoryList historyList;
public override void Initialize()
{
historyList = HistoryUtility.GetHistoryList();
}
public override void Draw(EditorHistoryWindow window, Rect rect, Styles styles)
{
const float PADDING = 4.0f;
const float ICON_SIZE = 20.0f;
const float BUTTON_SIZE = 50.0f;
GUI.BeginGroup(rect, styles.toolbox);
{
var r0 = new Rect(0.0f, 0.0f, rect.width - BUTTON_SIZE, rect.height);
var r1 = new Rect(r0.xMax, 0.0f, BUTTON_SIZE, rect.height);
searchStr = EditorGUI.TextField(r0, searchStr);
var r0 = new Rect(PADDING, 0.0f, ICON_SIZE, rect.height);
var r1 = new Rect(r0.xMax, 0.0f, rect.width - BUTTON_SIZE - ICON_SIZE - PADDING * 2.0f, rect.height);
var r2 = new Rect(r1.xMax, 0.0f, BUTTON_SIZE, rect.height);
GUI.Label(r0, styles.iconSearch);
searchStr = EditorGUI.TextField(r1, searchStr);
if (GUI.Button(r1, "Clear"))
historyList.Clear();
if (GUI.Button(r2, "Clear"))
searchStr = string.Empty;
}
GUI.EndGroup();
}