Esempio n. 1
0
        public void UpdateMouse(Point currentPoint)
        {
            switch (state)
            {
            case TrackingState.STARTING:
                if (warp.IsWarpReady())
                {
                    state      = TrackingState.RUNNING;
                    finalPoint = currentPoint;
                }
                break;

            case TrackingState.RUNNING:
                if (movement == Movement.HOTKEY)
                {
                    if (updatedAtLeastOnce && !movementHotKeyDown)
                    {
                        break;
                    }
                }
                Point warpPoint = warp.GetNextPoint(currentPoint);
                if (mode == Mode.EYEX_AND_SMARTNAV || mode == Mode.EYEX_AND_EVIACAM || mode == Mode.EVIACAM_ONLY)
                {
                    warpPoint = limitToScreenBounds(warpPoint);
                    if (warpPoint != finalPoint)
                    {
                        finalPoint = warpPoint;
                        updateCursorPosition(finalPoint);
                    }
                }
                else
                {
                    if (PrecisionGazeMouseForm.MousePosition != finalPoint)
                    {
                        state     = TrackingState.PAUSED;
                        pauseTime = System.DateTime.Now;
                    }
                    finalPoint = prec.GetNextPoint(warpPoint);
                    finalPoint = limitToScreenBounds(finalPoint);
                    updateCursorPosition(finalPoint);
                }
                updatedAtLeastOnce = true;
                break;

            case TrackingState.PAUSED:
                // Keep pausing if the user is still moving the mouse
                if (lastCursorPosition != currentPoint)
                {
                    lastCursorPosition = currentPoint;
                    pauseTime          = System.DateTime.Now;
                }
                if (!pauseMode && System.DateTime.Now.CompareTo(pauseTime.AddSeconds(1)) > 0)
                {
                    state = TrackingState.STARTING;
                }
                break;

            case TrackingState.ERROR:
                if (warp.IsStarted() && prec.IsStarted())
                {
                    state = TrackingState.STARTING;
                }
                break;
            }
        }
Esempio n. 2
0
        public void UpdateMouse(Point currentPoint)
        {
            switch (state)
            {
            case TrackingState.STARTING:
                if (warp.IsWarpReady())
                {
                    state      = TrackingState.RUNNING;
                    finalPoint = currentPoint;
                }

                break;

            case TrackingState.RUNNING:
                if (movement == Movement.HOTKEY)
                {
                    if (updatedAtLeastOnce && !movementHotKeyDown)
                    {
                        break;
                    }
                }
                Point warpPoint = warp.GetNextPoint(currentPoint);

                /* if (mode == Mode.EYEX_AND_SMARTNAV || mode == Mode.EYEX_AND_EVIACAM || mode == Mode.EVIACAM_ONLY)
                 * {
                 *   warpPoint = limitToScreenBounds(warpPoint);
                 *   if (warpPoint != finalPoint)
                 *   {
                 *       finalPoint = warpPoint;
                 *       form.SetMousePosition(finalPoint);
                 *       Cursor.Position = finalPoint;
                 *   }
                 * }*/


                if (Main.MousePosition != finalPoint)
                {
                    state     = TrackingState.PAUSED;
                    pauseTime = System.DateTime.Now;
                }
                finalPoint = prec.GetNextPoint(warpPoint);
                finalPoint = limitToScreenBounds(finalPoint);

                /* if (mainFormIsThere)
                 *   form.SetMousePosition(finalPoint);
                 * if (overlayEyeNewFormIsThere)
                 *   formMagnifier.SetMousePosition(finalPoint);*/

                // formMagnifier.SetCursorPos(finalPoint.X,finalPoint);
                Cursor.Position = finalPoint;

                updatedAtLeastOnce = true;
                break;

            case TrackingState.PAUSED:
                // Keep pausing if the user is still moving the mouse
                if (lastCursorPosition != currentPoint)
                {
                    lastCursorPosition = currentPoint;
                    pauseTime          = System.DateTime.Now;
                }
                if (!pauseMode && System.DateTime.Now.CompareTo(pauseTime.AddSeconds(1)) > 0)
                {
                    state = TrackingState.STARTING;
                }
                break;

            case TrackingState.ERROR:
                if (warp.IsStarted() && prec.IsStarted())
                {
                    state = TrackingState.STARTING;
                }
                break;
            }
        }
        public void UpdateMouse(Point currentPoint)
        {
            switch (state)
            {
            case TrackingState.STARTING:
                if (warp.IsWarpReady())
                {
                    state      = TrackingState.RUNNING;
                    finalPoint = currentPoint;
                }
                break;

            case TrackingState.RUNNING:
                if (movement == Movement.HOTKEY)
                {
                    if (updatedAtLeastOnce && !movementHotKeyDown)
                    {
                        break;
                    }
                }
                Point warpPoint = warp.GetNextPoint(currentPoint);
                if (mode == Mode.EYEX_AND_SMARTNAV || mode == Mode.EYEX_AND_EVIACAM || mode == Mode.EVIACAM_ONLY)
                {
                    warpPoint = limitToScreenBounds(warpPoint);
                    if (warpPoint != finalPoint)
                    {
                        finalPoint = warpPoint;
                        updateCursorPosition(finalPoint);
                    }
                }
                else if (mode == Mode.TRACKIR_ONLY_JOYSTICK)
                {
                    TrackIRPrecisionPointer trackIRPrec = ((TrackIRPrecisionPointer)prec);
                    Point nextPoint = trackIRPrec.GetNextPoint(warpPoint);
                    int   diffX     = nextPoint.X - finalPoint.X;
                    int   diffY     = nextPoint.Y - finalPoint.Y;

                    if (trackIRPrec.xJoystickMode)
                    {
                        finalPoint.X = nextPoint.X;
                    }

                    if (trackIRPrec.yJoystickMode)
                    {
                        finalPoint.Y = nextPoint.Y;
                    }

                    sendRelativeMoveMouseEvent(
                        trackIRPrec.xJoystickMode ? diffX : nextPoint.X,
                        trackIRPrec.yJoystickMode ? diffY : nextPoint.Y);
                }
                else
                {
                    if (PrecisionGazeMouseForm.MousePosition != finalPoint)
                    {
                        state     = TrackingState.PAUSED;
                        pauseTime = System.DateTime.Now;
                    }
                    finalPoint = prec.GetNextPoint(warpPoint);
                    finalPoint = limitToScreenBounds(finalPoint);
                    updateCursorPosition(finalPoint);
                }
                updatedAtLeastOnce = true;
                break;

            case TrackingState.PAUSED:
                // Keep pausing if the user is still moving the mouse
                if (lastCursorPosition != currentPoint)
                {
                    lastCursorPosition = currentPoint;
                    pauseTime          = System.DateTime.Now;
                }
                if (!pauseMode && System.DateTime.Now.CompareTo(pauseTime.AddSeconds(1)) > 0)
                {
                    state = TrackingState.STARTING;
                }
                break;

            case TrackingState.ERROR:
                if (warp.IsStarted() && prec.IsStarted())
                {
                    state = TrackingState.STARTING;
                }
                break;
            }
        }
Esempio n. 4
0
        //returns true if a new update is made, false otherwise
        public bool UpdateMouse(Point currentPoint)
        {
            bool ret = false;

            switch (state)
            {
            case TrackingState.STARTING:
                if (warp.IsWarpReady())
                {
                    state      = TrackingState.RUNNING;
                    finalPoint = currentPoint;
                }
                break;

            case TrackingState.RUNNING:
                if (movement == Movement.HOTKEY)
                {
                    if (updatedAtLeastOnce && !hotKeyDown)
                    {
                        break;
                    }
                }
                Point warpPoint = warp.GetNextPoint(currentPoint);
                if (mode == Mode.EYEX_AND_SMARTNAV || mode == Mode.TRACKIR_ONLY)     //warps in a split second (EyeX is 60 Hz)
                {
                    if (warpPoint != finalPoint)
                    {
                        finalPoint = warpPoint;
                        form.SetMousePosition(finalPoint);
                        ret = true;
                    }
                }
                else     //eyex only, this one takes about a 3 second dwell for it to warp
                         //as well eyeX and TrackIR which is with warp + head movement
                {
                    if (PrecisionGazeMouseForm.MousePosition != finalPoint)
                    {
                        state     = TrackingState.PAUSED;
                        pauseTime = System.DateTime.Now;
                    }
                    finalPoint = prec.GetNextPoint(warpPoint);
                    form.SetMousePosition(finalPoint);
                    ret = true;
                }
                updatedAtLeastOnce = true;
                break;

            case TrackingState.PAUSED:
                // Keep pausing if the user is still moving the mouse
                if (lastCursorPosition != currentPoint)
                {
                    lastCursorPosition = currentPoint;
                    pauseTime          = System.DateTime.Now;
                }
                if (System.DateTime.Now.CompareTo(pauseTime.AddSeconds(1)) > 0)
                {
                    state = TrackingState.STARTING;
                }
                break;

            case TrackingState.ERROR:
                if (warp.IsStarted() && prec.IsStarted())
                {
                    state = TrackingState.STARTING;
                }
                break;
            }

            if (previousState != state)
            {
                Logger.WriteVar(nameof(state), state);
                previousState = state;
            }
            return(ret);
        }