1.8.5: Marking history elements as favorites will move them to the top of the list

This commit is contained in:
Anders Ejlersen 2023-03-28 18:31:47 +02:00
parent 5a2dcf3619
commit 959f012d80
7 changed files with 148 additions and 29 deletions

View file

@ -48,33 +48,47 @@ namespace Module.NavigationTool.Editor.History
viewSearchList.Draw(this, rectList, styles);
HandleClickEvent();
if (Event.current.type == EventType.Repaint && position.Contains(Event.current.mousePosition))
Repaint();
}
private void HandleClickEvent()
{
if (!EditorHistoryGUIUtility.isClicked)
return;
EditorHistoryList editorHistoryList = EditorHistoryUtility.GetHistoryList();
Object obj = editorHistoryList.GetObject(EditorHistoryGUIUtility.currentEntry);
if (obj != null)
if (EditorHistoryGUIUtility.isPinClicked)
{
if (EditorHistoryGUIUtility.isDoubleClick)
{
AssetDatabase.OpenAsset(obj);
}
if (EditorHistoryGUIUtility.isCurrentEntryPinned)
editorHistoryList.Unpin(EditorHistoryGUIUtility.currentEntry);
else
editorHistoryList.Pin(EditorHistoryGUIUtility.currentEntry);
}
else
{
Object obj = editorHistoryList.GetObject(EditorHistoryGUIUtility.currentEntry);
if (obj != null)
{
EditorHistoryListPostProcess.IgnoreNextSelectionChange();
if (EditorHistoryGUIUtility.isDoubleClick)
{
AssetDatabase.OpenAsset(obj);
}
else
{
EditorHistoryListPostProcess.IgnoreNextSelectionChange();
if (EditorHistoryPrefs.IsSetAsActiveObjectEnabled)
Selection.activeObject = obj;
if (EditorHistoryPrefs.IsSetAsActiveObjectEnabled)
Selection.activeObject = obj;
EditorGUIUtility.PingObject(obj);
EditorGUIUtility.PingObject(obj);
}
}
}
EditorHistoryGUIUtility.Used();
}