Commit 5eed1bba authored by Alexander Krause's avatar Alexander Krause

much better selection handling. open object disabled atm.

parent f02c6f43
......@@ -29,10 +29,12 @@ namespace ExplorVizGestureControl.Gestures
private GestureTimer scrollTimer;
private GestureTimer openObjectTimer;
private GestureTimer selectionObjectTimer;
internal static GestureTimer delayTimer;
private Boolean rotationActive = false;
private Boolean gripActive = false;
private Boolean selectionActive = false;
private Dictionary<string, double> dynamicValues = new Dictionary<string, double>();
......@@ -52,7 +54,7 @@ namespace ExplorVizGestureControl.Gestures
scrollTimer = new GestureTimer(dynamicValues["zoomVelocity"]);
openObjectTimer = new GestureTimer(450);
delayTimer = new GestureTimer(2000);
selectionObjectTimer = new GestureTimer(500);
}
#endregion
......@@ -145,10 +147,9 @@ namespace ExplorVizGestureControl.Gestures
private void HandleZoom()
{
if (gripActive) return;
int scrollValue = 0;
double distance = GestureDatabase.Joints[(int)JointType.SpineBase].Z - GestureDatabase.PreviousFrameJoints[(int)JointType.SpineBase].Z;
double distance = GestureDatabase.Joints[(int)JointType.SpineBase].Z -
GestureDatabase.PreviousFrameJoints[(int)JointType.SpineBase].Z;
if (Math.Abs(distance) != dynamicValues["scrollForwardFactor"])
{
......@@ -167,26 +168,43 @@ namespace ExplorVizGestureControl.Gestures
{
if (rotationActive) return;
if (selectionObjectTimer.busy && !GestureDatabase.DragObject() && selectionActive)
{
mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
selectionActive = false;
}
if (GestureDatabase.DragObject())
{
if (!selectionActive)
{
selectionObjectTimer.startTimer();
selectionActive = true;
return;
}
if (!gripActive)
{
if (selectionObjectTimer.busy) return;
gripActive = true;
if (openObjectTimer.busy)
{
mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
Thread.Sleep(150);
mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
// mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
// Thread.Sleep(150);
// mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
}
else
else
{
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
}
}
if (!gripActive) gripActive = true;
double distanceX = GestureDatabase.Joints[(int)JointType.HandRight].X - GestureDatabase.PreviousFrameJoints[(int)JointType.HandRight].X;
double distanceY = GestureDatabase.Joints[(int)JointType.HandRight].Y - GestureDatabase.PreviousFrameJoints[(int)JointType.HandRight].Y;
double distanceX = GestureDatabase.Joints[(int)JointType.HandRight].X -
GestureDatabase.PreviousFrameJoints[(int)JointType.HandRight].X;
double distanceY = GestureDatabase.Joints[(int)JointType.HandRight].Y -
GestureDatabase.PreviousFrameJoints[(int)JointType.HandRight].Y;
int moveX = (int)(distanceX * 1000);
int moveY = (int)(distanceY * 1000);
......@@ -197,6 +215,7 @@ namespace ExplorVizGestureControl.Gestures
{
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
gripActive = false;
selectionActive = false;
openObjectTimer.startTimer();
}
}
......
......@@ -88,8 +88,8 @@ namespace ExplorVizGestureControl.Gestures
phiz.center = new Point(joints[(int)JointType.ShoulderRight].X + 0.3, joints[(int)JointType.ShoulderRight].Y);
phiz.topRightCorner = new Point(phiz.center.X + 0.2, phiz.center.Y + 0.3);
phiz.botRightCorner = new Point(phiz.center.X + 0.2, phiz.center.Y - 0.1);
phiz.topLeftCorner = new Point(phiz.center.X - 0.2, phiz.center.Y + 0.3);
phiz.botLeftCorner = new Point(phiz.center.X - 0.2, phiz.center.Y - 0.1);
phiz.topLeftCorner = new Point(phiz.center.X - 0.4, phiz.center.Y + 0.3);
phiz.botLeftCorner = new Point(phiz.center.X - 0.4, phiz.center.Y - 0.1);
phiz.z = joints[(int)JointType.ShoulderRight].Z;
handLeftState = left;
......@@ -212,8 +212,7 @@ namespace ExplorVizGestureControl.Gestures
}
public static Boolean HandsCrossed()
{
Console.WriteLine(joints[(int)JointType.HandLeft].X - joints[(int)JointType.HandRight].X);
{
return joints[(int)JointType.HandLeft].X >= joints[(int)JointType.HandRight].X ? true : false;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment