0.4.0: Added double-click open to Favorites and History

This commit is contained in:
Anders Ejlersen 2021-02-14 21:28:18 +01:00
parent 9b73200c73
commit d35a79faf1
6 changed files with 59 additions and 5 deletions

View file

@ -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)
{