SetCursorPos() private method

private SetCursorPos ( int x, int y ) : long
x int
y int
return long
Ejemplo n.º 1
0
        // Line smoothing
        private void LineSmoothingUpdate(object sender, ElapsedEventArgs e)
        {
            Point guidePos = position;

            if (lastPosition == guidePos)
            {
                mouseMoving = false;
            }
            else
            {
                mouseMoving = true;
            }
            lastPosition = guidePos;

            try
            {
                // Begin smoothing only if we have points to work with and if drawing
                if (smoothPoints.Count > 0 && isDrawing)
                {
                    if (config.disableCatchUp)
                    {
                        if (mouseMoving)
                        {
                            MouseHook.SetCursorPos(smoothPoints[0].X, smoothPoints[0].Y);
                            smoothPoints.RemoveAt(0);
                        }
                    }
                    else
                    {
                        MouseHook.SetCursorPos(smoothPoints[0].X, smoothPoints[0].Y);
                        smoothPoints.RemoveAt(0);
                    }
                }
            }
            catch
            {
                // Fail smoothing gracefully
            }

            if (!isDrawing)
            {
                smoothPoints.Clear();
                lineSmoothingTimer.Stop();
                if (!config.snapToCursor)
                {
                    MouseHook.SetCursorPos(guidePos.X, guidePos.Y);
                }
                MouseHook.moveEnabled = true;
                MouseHook.downEnabled = true;
            }
        }
Ejemplo n.º 2
0
 private void MouseUpHandler(object sender, EventArgs e)
 {
     if (smoothingOn)
     {
         if (config.smoothOnDraw && isDrawing)
         {
             MouseHook.downEnabled = false;
             isDrawing             = false;
             lineProcessingTimer.Stop();
             linePoints.Clear();
             if (!config.snapToCursor)
             {
                 Point guidePos = overlay.cursorPos;
                 MouseHook.SetCursorPos(guidePos.X, guidePos.Y);
             }
             else
             {
                 overlay.cursorPos = MouseHook.GetCursorPosition();
             }
         }
     }
 }