Commit 57d7ad0f authored by Alexander Krause's avatar Alexander Krause

zooming will only process every 3rd frame

parent e20f274c
......@@ -49,7 +49,7 @@ namespace ExplorVizGestureControl.Gestures
KinectSensor kinect = KinectSensor.GetDefault();
// dynamic values initialization, based on gui
dynamicValues.Add("scrollAccelerationFactor", 2000);
dynamicValues.Add("scrollAccelerationFactor", 20000);
dynamicValues.Add("scrollActivation", 0.05);
dynamicValues.Add("zoomVelocity", 700);
dynamicValues.Add("rotationVelocityX", 2000);
......@@ -164,23 +164,28 @@ namespace ExplorVizGestureControl.Gestures
private Boolean zoomingActive = false;
private int zoomStatus = 0;
private int counter = 0;
private void HandleZoom()
{
if (rotationActive || gripActive || scrollTimer.busy) return;
double distance = GestureDatabase.Joints[(int)JointType.HandRight].Z -
float distance = GestureDatabase.Joints[(int)JointType.HandRight].Z -
GestureDatabase.PreviousFrameJoints[(int)JointType.HandRight].Z;
if (GestureDatabase.ZoomingInitialized())
{
counter = ++counter % 3;
if (counter != 0) return;
zoomingActive = true;
if (distance >= 0 && GestureDatabase.BothHandsClosed())
if (distance >= 0f && GestureDatabase.BothHandsClosed())
{
zoomStatus = 1;
}
else if (distance < 0 && GestureDatabase.BothHandsClosed()) { return; }
else if (distance < 0f && GestureDatabase.BothHandsClosed()) { return; }
if (distance < 0 && GestureDatabase.BothHandsOpen())
{
......@@ -193,7 +198,7 @@ namespace ExplorVizGestureControl.Gestures
zoomStatus = 2;
}
else if (distance >= 0 && GestureDatabase.BothHandsOpen()) { return; }
int scrollValue = (int)(distance * dynamicValues["scrollAccelerationFactor"]);
mouse_event(MOUSEEVENTF_WHEEL, 0, 0, scrollValue, 0);
}
......
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