0.4.0: Added double-click open to Favorites and History
This commit is contained in:
parent
9b73200c73
commit
d35a79faf1
6 changed files with 59 additions and 5 deletions
|
|
@ -5,6 +5,7 @@
|
|||
None,
|
||||
BeginClick,
|
||||
PerformedClick,
|
||||
PerformedDoubleClick,
|
||||
EndClick,
|
||||
BeginContextClick,
|
||||
PerformedContextClick,
|
||||
|
|
|
|||
|
|
@ -12,6 +12,10 @@ namespace Game.NavigationTool.Editor.Favorite
|
|||
public static EManipulatingState manipulatingState;
|
||||
public static Vector2 manipulatingMouseOffset;
|
||||
public static Rect manipulatingRect;
|
||||
|
||||
private static Favorites.Entry LAST_CLICK_ENTRY;
|
||||
private static double LAST_CLICK_TIME;
|
||||
private static int CLICK_COUNT;
|
||||
|
||||
public static Favorites.Entry hoverEntry;
|
||||
|
||||
|
|
@ -40,9 +44,22 @@ namespace Game.NavigationTool.Editor.Favorite
|
|||
if (manipulatingState == EManipulatingState.BeginClick)
|
||||
{
|
||||
if (intersects && Event.current.button == 0)
|
||||
SetManipulating(rect, entry, EManipulatingState.PerformedClick);
|
||||
{
|
||||
double dt = EditorApplication.timeSinceStartup - LAST_CLICK_TIME;
|
||||
|
||||
if (dt < 0.3 && CLICK_COUNT == 1 && LAST_CLICK_ENTRY == entry)
|
||||
CLICK_COUNT++;
|
||||
else
|
||||
CLICK_COUNT = 1;
|
||||
|
||||
LAST_CLICK_ENTRY = entry;
|
||||
LAST_CLICK_TIME = EditorApplication.timeSinceStartup;
|
||||
SetManipulating(rect, entry, CLICK_COUNT == 1 ? EManipulatingState.PerformedClick : EManipulatingState.PerformedDoubleClick);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetManipulating(rect, entry, EManipulatingState.EndClick);
|
||||
}
|
||||
}
|
||||
else if (manipulatingState == EManipulatingState.BeginContextClick)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -101,6 +101,12 @@ namespace Game.NavigationTool.Editor.Favorite
|
|||
favorites.Save();
|
||||
}
|
||||
|
||||
FavoritesGUIUtility.ClearManipulating();
|
||||
break;
|
||||
case EManipulatingState.PerformedDoubleClick:
|
||||
if (entry.isAsset)
|
||||
AssetDatabase.OpenAsset(favorites.GetObject(entry));
|
||||
|
||||
FavoritesGUIUtility.ClearManipulating();
|
||||
break;
|
||||
case EManipulatingState.BeginDrag:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue