Esempio n. 1
0
 public static void RightClick()
 {
     MouseSimulator.ClickRightMouseButton();
 }
Esempio n. 2
0
        public static void RunMouse(FingerList Fingers)
        {
            List <Finger> sortedFingers = Fingers.OrderBy(Finger => Finger.TimeVisible).ToList();

            sortedFingers.Reverse();

            float speed = Properties.Settings.Default.MouseCursorSpeed;
            int   max   = 1;

            int numFingers = sortedFingers.Count;

            if (sortedFingers.Count >= max)
            {
                numFingers = max;
            }

            //numFingers - 1
            for (int i = 0; i <= numFingers - 1; i++)
            {
                if (sortedFingers[i].TipPosition.z < Properties.Settings.Default.TouchThreshold)
                {
                    isTouching[i] = true;
                }
                else
                {
                    isTouching[i] = false;
                }

                if (isTouching[i] == true && Holding[i] == false) // pressed
                {
                    JustPressed[i] = true;
                    Holding[i]     = true;
                }

                if (isTouching[i] == false && Holding[i] == true) // released
                {
                    JustReleased[i] = true;
                    Holding[i]      = false;
                }


                if (JustPressed[i])
                {
                    JustPressed[i] = false;
                    //MouseSimulator.ClickLeftMouseButton();
                    MouseSimulator.LeftMouseDown();
                }

                if (JustReleased[i])
                {
                    JustReleased[i] = false;
                    MouseSimulator.LeftMouseUp();
                }

                if (sortedFingers.Count > 1 && sortedFingers[1].TipPosition.z < Properties.Settings.Default.TouchThreshold)
                {
                    if (rightClickTimer <= 0)
                    {
                        MouseSimulator.ClickRightMouseButton();
                        rightClickTimer = 50;
                    }
                }
                if (rightClickTimer > 0)
                {
                    rightClickTimer--;
                }

                //if (Holding[i] == false)

                injector[i].PointerInfo.PtPixelLocation.X = (int)(sortedFingers[i].TipPosition.x * Properties.Settings.Default.TouchCursorSpeed) + 1000;  // 1000, 900
                injector[i].PointerInfo.PtPixelLocation.Y = -(int)(sortedFingers[i].TipPosition.y * Properties.Settings.Default.TouchCursorSpeed) + 2500; // speed 15: add 2500, 700
            }

            MouseSimulator.getCoords();

            if (sortedFingers[0].TipPosition.z < Properties.Settings.Default.TouchThreshold + 30)
            {
                MouseSimulator.MoveCursor(MouseSimulator.mousePos.X + (int)(sortedFingers[0].TipVelocity.x * speed), MouseSimulator.mousePos.Y - (int)(sortedFingers[0].TipVelocity.y * speed));
            }

            SettingsWindow.debugText[1] = "Screen Coords:\n" + "X:" + MouseSimulator.mousePos.X + "  Y: " + MouseSimulator.mousePos.Y;

            SettingsWindow.debugText[2] = "RCT: " + rightClickTimer;

            SettingsWindow.debugText[4] = "Finger IDs: ";
            foreach (Finger f in sortedFingers)
            {
                SettingsWindow.debugText[4] += " " + f.Id;
            }
        }