Esempio n. 1
0
 public void touchesBegan(TouchpadEventArgs arg)
 {
     if (arg.touches.Length == 1)
     {
         horizontalRemainder = verticalRemainder = 0.0;
         horizontalDirection = verticalDirection = Direction.Neutral;
     }
 }
Esempio n. 2
0
        private void OnControllerTouchPadMoved(object sender, TouchpadEventArgs e)
        {
            int dX = e.touches[0].deltaX;
            int dY = e.touches[0].deltaY;

            // TODO: perform upper and lower bound checks here...

            OnDeviceTouchPadMoved(dX, dY);
        }
Esempio n. 3
0
 public virtual void touchButtonUp(object sender, TouchpadEventArgs arg)
 {
     pushed    = DS4Controls.None;
     upperDown = leftDown = rightDown = multiDown = false;
     dev.SetRumble(0, 0);
     dev.GetCurrentState(s);
     if (s.Touch1 || s.Touch2)
     {
         synthesizeMouseButtons();
     }
 }
Esempio n. 4
0
        private void ProcessActiveContact(TouchpadEventArgs eventArgs)
        {
            // If we're not inside an active 'tap', instantiate one.
            if (currentTap == null)
            {
                currentTap = new TapData(Constants.MaxContacts);
            }

            bool wasActive = currentTap.InstantaneousActiveContacts[eventArgs.ContactIndex];

            currentTap.InstantaneousActiveContacts[eventArgs.ContactIndex] = true;

            // If we were previously active, add the distance from the last X/Y
            // to this new one to the total distance in the tap object.
            if (wasActive)
            {
                uint previousX = currentTap.PreviousXValues[eventArgs.ContactIndex];
                uint previousY = currentTap.PreviousYValues[eventArgs.ContactIndex];

                double positionDelta = Math.Sqrt(Math.Pow((double)eventArgs.X - previousX, 2) + Math.Pow((double)eventArgs.Y - previousY, 2));
                currentTap.TotalContactDistances[eventArgs.ContactIndex] += positionDelta;
            }

            currentTap.MaximumActiveContacts = Math.Max(currentTap.InstantaneousActiveContacts.Count(ac => ac), currentTap.MaximumActiveContacts);
            currentTap.MaximumPressure       = Math.Max(currentTap.MaximumPressure, eventArgs.Pressure);

            currentTap.PreviousXValues[eventArgs.ContactIndex] = eventArgs.X;
            currentTap.PreviousYValues[eventArgs.ContactIndex] = eventArgs.Y;

            if (eventArgs.Pressure >= config.TapTriggerThreshold)
            {
                currentTap.TapThresholdMet = true;
            }

            // If we're not minimized, update the form values
            if (WindowState != FormWindowState.Minimized &&
                (!lastActiveContactUiUpdates[eventArgs.ContactIndex].HasValue || (DateTime.Now - lastActiveContactUiUpdates[eventArgs.ContactIndex].Value).TotalMilliseconds >= 50))
            {
                ActiveContactDisplay contactDisplay = activeContactDisplays[eventArgs.ContactIndex];

                contactDisplay.Active   = true;
                contactDisplay.Pressure = eventArgs.Pressure;
                contactDisplay.X        = eventArgs.X;
                contactDisplay.Y        = eventArgs.Y;

                lastActiveContactUiUpdates[eventArgs.ContactIndex] = DateTime.Now;
            }
        }
Esempio n. 5
0
        private static void DS4TouchpadMoved(object sender, TouchpadEventArgs args)
        {
            if (!Settings.Default.EnableTouchpad)
            {
                return;
            }

            var x = args.touches.Last().deltaX;
            var y = args.touches.Last().deltaY;

            var cur = Cursor.Position;

            cur.X          += x;
            cur.Y          += y;
            Cursor.Position = cur;
        }
Esempio n. 6
0
        public void TouchesMoved(TouchpadEventArgs arg, bool dragging)
        {
            if (arg.TouchReadings.Length != 2 || dragging)
            {
                return;
            }

            var lastT0 = arg.TouchReadings[0].PreviousTouchReadings;
            var lastT1 = arg.TouchReadings[1].PreviousTouchReadings;
            var T0     = arg.TouchReadings[0];
            var T1     = arg.TouchReadings[1];

            //mouse wheel 120 == 1 wheel click according to Windows API
            double lastMidX = (lastT0.hwX + lastT1.hwX) / 2d, lastMidY = (lastT0.hwY + lastT1.hwY) / 2d,
                   currentMidX = (T0.hwX + T1.hwX) / 2d, currentMidY = (T0.hwY + T1.hwY) / 2d;
            double coefficient = Global.ScrollSensitivity[deviceNumber];
            // Adjust for touch distance: "standard" distance is 960 pixels, i.e. half the width.  Scroll farther if fingers are farther apart, and vice versa, in linear proportion.
            double touchXDistance = T1.hwX - T0.hwX, touchYDistance = T1.hwY - T0.hwY, touchDistance = Math.Sqrt(touchXDistance * touchXDistance + touchYDistance * touchYDistance);

            coefficient *= touchDistance / 960.0;

            // Collect rounding errors instead of losing motion.
            var xMotion = coefficient * (currentMidX - lastMidX);

            if (xMotion > 0.0 && horizontalRemainder > 0.0 || xMotion < 0.0 && horizontalRemainder < 0.0)
            {
                xMotion += horizontalRemainder;
            }
            var xAction = (int)xMotion;

            horizontalRemainder = xMotion - xAction;

            var yMotion = coefficient * (lastMidY - currentMidY);

            if (yMotion > 0.0 && verticalRemainder > 0.0 || yMotion < 0.0 && verticalRemainder < 0.0)
            {
                yMotion += verticalRemainder;
            }
            var yAction = (int)yMotion;

            verticalRemainder = yMotion - yAction;

            if (yAction != 0 || xAction != 0)
            {
                InputMethods.MouseWheel(yAction, xAction);
            }
        }
Esempio n. 7
0
 public virtual void touchesMoved(object sender, TouchpadEventArgs arg)
 {
     if (!Global.UseTPforControls[deviceNum])
     {
         cursor.touchesMoved(arg, dragging || dragging2);
         wheel.TouchesMoved(arg, dragging || dragging2);
     }
     else
     {
         if (!(swipeUp || swipeDown || swipeLeft || swipeRight) && arg.TouchReadings.Length == 1)
         {
             if (arg.TouchReadings[0].hwX - FirstTouchReadings.hwX > 400)
             {
                 swipeRight = true;
             }
             if (arg.TouchReadings[0].hwX - FirstTouchReadings.hwX < -400)
             {
                 swipeLeft = true;
             }
             if (arg.TouchReadings[0].hwY - FirstTouchReadings.hwY > 300)
             {
                 swipeDown = true;
             }
             if (arg.TouchReadings[0].hwY - FirstTouchReadings.hwY < -300)
             {
                 swipeUp = true;
             }
         }
         swipeUpB    = (byte)Math.Min(255, Math.Max(0, (FirstTouchReadings.hwY - arg.TouchReadings[0].hwY) * 1.5f));
         swipeDownB  = (byte)Math.Min(255, Math.Max(0, (arg.TouchReadings[0].hwY - FirstTouchReadings.hwY) * 1.5f));
         swipeLeftB  = (byte)Math.Min(255, Math.Max(0, FirstTouchReadings.hwX - arg.TouchReadings[0].hwX));
         swipeRightB = (byte)Math.Min(255, Math.Max(0, arg.TouchReadings[0].hwX - FirstTouchReadings.hwX));
     }
     if (Math.Abs(FirstTouchReadings.hwY - arg.TouchReadings[0].hwY) < 50 && arg.TouchReadings.Length == 2)
     {
         if (arg.TouchReadings[0].hwX - FirstTouchReadings.hwX > 200 && !slideleft)
         {
             slideright = true;
         }
         else if (FirstTouchReadings.hwX - arg.TouchReadings[0].hwX > 200 && !slideright)
         {
             slideleft = true;
         }
     }
     dev.GetCurrentState(s);
     synthesizeMouseButtons();
 }
Esempio n. 8
0
 public virtual void touchesMoved(object sender, TouchpadEventArgs arg)
 {
     if (!Global.getUseTPforControls(deviceNum))
     {
         cursor.touchesMoved(arg);
         wheel.touchesMoved(arg);
     }
     else
     {
         if (!(swipeUp || swipeDown || swipeLeft || swipeRight) && arg.touches.Length == 1)
         {
             if (arg.touches[0].hwX - firstTouch.hwX > 200)
             {
                 swipeRight = true;
             }
             if (arg.touches[0].hwX - firstTouch.hwX < -200)
             {
                 swipeLeft = true;
             }
             if (arg.touches[0].hwY - firstTouch.hwY > 150)
             {
                 swipeDown = true;
             }
             if (arg.touches[0].hwY - firstTouch.hwY < -150)
             {
                 swipeUp = true;
             }
         }
         swipeUpB    = (byte)Math.Min(255, Math.Max(0, (firstTouch.hwY - arg.touches[0].hwY) * 1.5f));
         swipeDownB  = (byte)Math.Min(255, Math.Max(0, (arg.touches[0].hwY - firstTouch.hwY) * 1.5f));
         swipeLeftB  = (byte)Math.Min(255, Math.Max(0, firstTouch.hwX - arg.touches[0].hwX));
         swipeRightB = (byte)Math.Min(255, Math.Max(0, arg.touches[0].hwX - firstTouch.hwX));
     }
     if (Math.Abs(firstTouch.hwY - arg.touches[0].hwY) < 50 && arg.touches.Length == 2)
     {
         if (arg.touches[0].hwX - firstTouch.hwX > 200 && !slideleft)
         {
             slideright = true;
         }
         else if (firstTouch.hwX - arg.touches[0].hwX > 200 && !slideright)
         {
             slideleft = true;
         }
     }
     dev.getCurrentState(s);
     synthesizeMouseButtons();
 }
Esempio n. 9
0
 public virtual void touchesBegan(object sender, TouchpadEventArgs arg)
 {
     cursor.touchesBegan(arg);
     wheel.touchesBegan(arg);
     pastTime   = arg.timeStamp;
     firstTouch = arg.touches[0];
     if (Global.getDoubleTap(deviceNum))
     {
         DateTime test = arg.timeStamp;
         if (test <= (firstTap + TimeSpan.FromMilliseconds((double)Global.getTapSensitivity(deviceNum) * 1.5)) && !arg.touchButtonPressed)
         {
             secondtouchbegin = true;
         }
     }
     dev.getCurrentState(s);
     synthesizeMouseButtons();
     //Console.WriteLine(arg.timeStamp.ToString("O") + " " + "began at " + arg.touches[0].hwX + "," + arg.touches[0].hwY);
 }
Esempio n. 10
0
 public virtual void touchesBegan(object sender, TouchpadEventArgs arg)
 {
     if (!Global.UseTPforControls[deviceNum])
     {
         cursor.touchesBegan(arg);
         wheel.TouchesBegan(arg);
     }
     pastTime           = arg.timeStamp;
     FirstTouchReadings = arg.TouchReadings[0];
     if (Global.DoubleTap[deviceNum])
     {
         var test = arg.timeStamp;
         if (test <= firstTap + TimeSpan.FromMilliseconds((double)Global.TapSensitivity[deviceNum] * 1.5) && !arg.touchButtonPressed)
         {
             secondtouchbegin = true;
         }
     }
     dev.GetCurrentState(s);
     synthesizeMouseButtons();
 }
Esempio n. 11
0
 public virtual void touchesBegan(object sender, TouchpadEventArgs arg)
 {
     if (!Global.getUseTPforControls(deviceNum))
     {
         cursor.touchesBegan(arg);
         wheel.touchesBegan(arg);
     }
     pastTime   = arg.timeStamp;
     firstTouch = arg.touches[0];
     if (Global.getDoubleTap(deviceNum))
     {
         DateTime test = arg.timeStamp;
         if (test <= (firstTap + TimeSpan.FromMilliseconds((double)Global.getTapSensitivity(deviceNum) * 1.5)) && !arg.touchButtonPressed)
         {
             secondtouchbegin = true;
         }
     }
     dev.getCurrentState(s);
     synthesizeMouseButtons();
 }
Esempio n. 12
0
        private static void DS4TouchpadButtonDown(object sender, TouchpadEventArgs args)
        {
            if (!Settings.Default.EnableTouchpad)
            {
                return;
            }

            switch (Settings.Default.TouchpadMode)
            {
            case 0:
                WoWInput.SendMouseDown(args.touches.Last().hwX < (1920 / 2) ? MouseButton.Left : MouseButton.Right);
                break;

            case 1:
                WoWInput.SendKeyDown(args.touches.Last().hwX < (1920 / 2)
                        ? BindManager.GetKey(GamepadButton.CenterLeft)
                        : BindManager.GetKey(GamepadButton.CenterRight));
                break;
            }
        }
Esempio n. 13
0
 public virtual void touchButtonDown(object sender, TouchpadEventArgs arg)
 {
     //byte leftRumble, rightRumble;
     if (arg.touches == null)
     {
         //No touches, finger on upper portion of touchpad
         //leftRumble = rightRumble = 0;
         upperDown = true;
     }
     else if (arg.touches.Length > 1) //|| (Global.getLowerRCOn(deviceNum) && arg.touches[0].hwX > (1920 * 3) / 4 && arg.touches[0].hwY > (960 * 3) / 4))
     {
         //leftRumble = rightRumble = 150;
         multiDown = true;
     }
     else
     {
         if ((Global.getLowerRCOn(deviceNum) && arg.touches[0].hwX > (1920 * 3) / 4 && arg.touches[0].hwY > (960 * 3) / 4))
         {
             Mapping.MapClick(deviceNum, Mapping.Click.Right);
         }
         if (isLeft(arg.touches[0]))
         {
             leftDown = true;
             //leftRumble = 25;
             //rightRumble = 0;
         }
         else if (isRight(arg.touches[0]))
         {
             rightDown = true;
             //leftRumble = 0;
             //rightRumble = 25;
         }
         else
         {
         }
     }
     dev.getCurrentState(s);
     synthesizeMouseButtons();
 }
Esempio n. 14
0
 public virtual void touchesMoved(object sender, TouchpadEventArgs arg)
 {
     cursor.touchesMoved(arg);
     wheel.touchesMoved(arg);
     if (Math.Abs(firstTouch.hwY - arg.touches[0].hwY) < 50)
     {
         if (arg.touches.Length == 2)
         {
             if (arg.touches[0].hwX - firstTouch.hwX > 200 && !slideleft)
             {
                 slideright = true;
             }
             else if (firstTouch.hwX - arg.touches[0].hwX > 200 && !slideright)
             {
                 slideleft = true;
             }
         }
     }
     dev.getCurrentState(s);
     synthesizeMouseButtons();
     //if (arg.touches.Length == 2)
     // Console.WriteLine("Left " + slideleft + " Right " + slideright);
 }
Esempio n. 15
0
        public void touchesMoved(TouchpadEventArgs arg, bool dragging, bool disableInvert = false)
        {
            int touchesLen = arg.touches.Length;

            if ((!dragging && touchesLen != 1) || (dragging && touchesLen < 1))
            {
                return;
            }

            int deltaX = 0, deltaY = 0;

            if (arg.touches[0].touchID != lastTouchID)
            {
                deltaX = deltaY = 0;
                horizontalRemainder = verticalRemainder = 0.0;
                horizontalDirection = verticalDirection = Direction.Neutral;
                lastTouchID         = arg.touches[0].touchID;
            }
            else
            {
                if (dragging && touchesLen > 1)
                {
                    deltaX = arg.touches[1].deltaX;
                    deltaY = arg.touches[1].deltaY;
                }
                else
                {
                    deltaX = arg.touches[0].deltaX;
                    deltaY = arg.touches[0].deltaY;
                }
            }

            double tempAngle           = System.Math.Atan2(-deltaY, deltaX);
            double normX               = System.Math.Abs(System.Math.Cos(tempAngle));
            double normY               = System.Math.Abs(System.Math.Sin(tempAngle));
            int    signX               = System.Math.Sign(deltaX);
            int    signY               = System.Math.Sign(deltaY);
            double coefficient         = Global.getTouchSensitivity(deviceNumber) * 0.01;
            bool   jitterCompenstation = Global.getTouchpadJitterCompensation(deviceNumber);

            double xMotion = deltaX != 0 ?
                             coefficient * deltaX + (normX * (TOUCHPAD_MOUSE_OFFSET * signX)) : 0.0;

            double yMotion = deltaY != 0 ?
                             coefficient * deltaY + (normY * (TOUCHPAD_MOUSE_OFFSET * signY)) : 0.0;

            if (jitterCompenstation)
            {
                double absX = System.Math.Abs(xMotion);
                if (absX <= normX * 0.4)
                {
                    xMotion = signX * System.Math.Pow(absX / 0.4f, 1.44) * 0.4;
                }

                double absY = System.Math.Abs(yMotion);
                if (absY <= normY * 0.4)
                {
                    yMotion = signY * System.Math.Pow(absY / 0.4f, 1.44) * 0.4;
                }
            }

            // Collect rounding errors instead of losing motion.
            if (xMotion > 0.0 && horizontalRemainder > 0.0)
            {
                xMotion += horizontalRemainder;
            }
            else if (xMotion < 0.0 && horizontalRemainder < 0.0)
            {
                xMotion += horizontalRemainder;
            }
            int xAction = (int)xMotion;

            horizontalRemainder = xMotion - xAction;

            if (yMotion > 0.0 && verticalRemainder > 0.0)
            {
                yMotion += verticalRemainder;
            }
            else if (yMotion < 0.0 && verticalRemainder < 0.0)
            {
                yMotion += verticalRemainder;
            }
            int yAction = (int)yMotion;

            verticalRemainder = yMotion - yAction;

            if (disableInvert == false)
            {
                int touchpadInvert = tempInt = Global.getTouchpadInvert(deviceNumber);
                if ((touchpadInvert & 0x02) == 2)
                {
                    xAction *= -1;
                }

                if ((touchpadInvert & 0x01) == 1)
                {
                    yAction *= -1;
                }
            }

            if (yAction != 0 || xAction != 0)
            {
                InputMethods.MoveCursorBy(xAction, yAction);
            }

            horizontalDirection = xMotion > 0.0 ? Direction.Positive : xMotion < 0.0 ? Direction.Negative : Direction.Neutral;
            verticalDirection   = yMotion > 0.0 ? Direction.Positive : yMotion < 0.0 ? Direction.Negative : Direction.Neutral;
        }
Esempio n. 16
0
 private void OnTouchesEnded(object sender, TouchpadEventArgs e)
 {
     IsTouched = false;
 }
Esempio n. 17
0
 private void OnTouchesBegan(object sender, TouchpadEventArgs e)
 {
     IsTouched = true;
 }
Esempio n. 18
0
 private void OnTouchesMoved(object sender, TouchpadEventArgs args)
 {
     Touches = args.touches;
 }
Esempio n. 19
0
        private void HandleContactEnd(object sender, TouchpadEventArgs e)
        {
            // If the tap object is null, just bail out
            if (currentTap == null)
            {
                return;
            }

            currentTap.InstantaneousActiveContacts[e.ContactIndex] = false;
            int currentActiveContacts = currentTap.InstantaneousActiveContacts.Count(ac => ac);

            // Has the tap ended?
            if (currentActiveContacts == 0)
            {
                DateTime tapEnd = DateTime.Now;

                // Okay, was this *really* a tap?
                // We need to validate by checking the total duration, whether the pressure threshold was met,
                // and if the distance was within the maximum range.
                if ((tapEnd - currentTap.Start).TotalMilliseconds <= config.MaxTapMilliseconds &&
                    currentTap.TapThresholdMet &&
                    currentTap.TotalContactDistances.Max() <= config.MaxTapDeltaPosition)
                {
                    // If it was a single-finger tap, inject a left click.
                    if (currentTap.MaximumActiveContacts == 1)
                    {
                        SendLeftClick();
                    }
                    // If it was a double-finger tap, inject a right click.
                    else if (currentTap.MaximumActiveContacts == 2)
                    {
                        SendRightClick();
                    }
                    else if (currentTap.MaximumActiveContacts == 3)
                    {
                        SendMiddleClick();
                    }
                }

                // Store reference to previous tap. Will probably need this later
                // if we want to add in support for double-tap-and-drag.
                previousTap = currentTap;

                // Clear out current tap, for it is over and done
                currentTap = null;

                // If we're not minimized, update form values
                if (WindowState != FormWindowState.Minimized)
                {
                    // Update previous tap display
                    previousMaxPressureLabel.Text  = previousTap.MaximumPressure.ToString();
                    previousDurationLabel.Text     = ((int)(tapEnd - previousTap.Start).TotalMilliseconds).ToString();
                    previousMaxDistanceLabel.Text  = ((int)previousTap.TotalContactDistances.Max()).ToString();
                    previousContactCountLabel.Text = previousTap.MaximumActiveContacts.ToString();

                    previousMaxPressureLabel.ForeColor = previousTap.MaximumPressure >= config.TapTriggerThreshold
                        ? Color.DarkGreen
                        : Color.DarkRed;
                    previousDurationLabel.ForeColor = (tapEnd - previousTap.Start).TotalMilliseconds < config.MaxTapMilliseconds
                        ? Color.DarkGreen
                        : Color.DarkRed;
                    previousMaxDistanceLabel.ForeColor = previousTap.TotalContactDistances.Max() < config.MaxTapDeltaPosition
                        ? Color.DarkGreen
                        : Color.DarkRed;
                    previousContactCountLabel.ForeColor = previousTap.MaximumActiveContacts >= 1 && previousTap.MaximumActiveContacts <= 3
                        ? Color.Green
                        : Color.DarkRed;
                }
            }

            if (WindowState != FormWindowState.Minimized)
            {
                ActiveContactDisplay contactDisplay = activeContactDisplays[e.ContactIndex];

                contactDisplay.Active   = false;
                contactDisplay.Pressure = 0;
                contactDisplay.X        = 0;
                contactDisplay.Y        = 0;
            }
        }
Esempio n. 20
0
        public void touchesMoved(TouchpadEventArgs arg, bool dragging)
        {
            int touchesLen = arg.touches.Length;

            if ((!dragging && touchesLen != 1) || (dragging && touchesLen < 1))
            {
                return;
            }

            int deltaX, deltaY;

            if (arg.touches[0].touchID != lastTouchID)
            {
                deltaX = deltaY = 0;
                horizontalRemainder = verticalRemainder = 0.0;
                horizontalDirection = verticalDirection = Direction.Neutral;
                lastTouchID         = arg.touches[0].touchID;
            }
            else if (Global.TouchpadJitterCompensation[deviceNumber])
            {
                // Often the DS4's internal jitter compensation kicks in and starts hiding changes, ironically creating jitter...
                if (dragging && touchesLen > 1)
                {
                    deltaX = arg.touches[1].deltaX;
                    deltaY = arg.touches[1].deltaY;
                }
                else
                {
                    deltaX = arg.touches[0].deltaX;
                    deltaY = arg.touches[0].deltaY;
                }

                // allow only very fine, slow motions, when changing direction, even from neutral
                // TODO maybe just consume it completely?
                if (deltaX <= -1)
                {
                    if (horizontalDirection != Direction.Negative)
                    {
                        deltaX = -1;
                        horizontalRemainder = 0.0;
                    }
                }
                else if (deltaX >= 1)
                {
                    if (horizontalDirection != Direction.Positive)
                    {
                        deltaX = 1;
                        horizontalRemainder = 0.0;
                    }
                }

                if (deltaY <= -1)
                {
                    if (verticalDirection != Direction.Negative)
                    {
                        deltaY            = -1;
                        verticalRemainder = 0.0;
                    }
                }
                else if (deltaY >= 1)
                {
                    if (verticalDirection != Direction.Positive)
                    {
                        deltaY            = 1;
                        verticalRemainder = 0.0;
                    }
                }
            }
            else
            {
                if (dragging && touchesLen > 1)
                {
                    deltaX = arg.touches[1].deltaX;
                    deltaY = arg.touches[1].deltaY;
                }
                else
                {
                    deltaX = arg.touches[0].deltaX;
                    deltaY = arg.touches[0].deltaY;
                }
            }

            double coefficient = Global.TouchSensitivity[deviceNumber] / 100.0;
            // Collect rounding errors instead of losing motion.
            double xMotion = coefficient * deltaX;

            if (xMotion > 0.0)
            {
                if (horizontalRemainder > 0.0)
                {
                    xMotion += horizontalRemainder;
                }
            }
            else if (xMotion < 0.0)
            {
                if (horizontalRemainder < 0.0)
                {
                    xMotion += horizontalRemainder;
                }
            }
            int xAction = (int)xMotion;

            horizontalRemainder = xMotion - xAction;

            double yMotion = coefficient * deltaY;

            if (yMotion > 0.0)
            {
                if (verticalRemainder > 0.0)
                {
                    yMotion += verticalRemainder;
                }
            }
            else if (yMotion < 0.0)
            {
                if (verticalRemainder < 0.0)
                {
                    yMotion += verticalRemainder;
                }
            }
            int yAction = (int)yMotion;

            verticalRemainder = yMotion - yAction;

            if (yAction != 0 || xAction != 0)
            {
                InputMethods.MoveCursorBy(xAction, yAction);
            }

            horizontalDirection = xMotion > 0.0 ? Direction.Positive : xMotion < 0.0 ? Direction.Negative : Direction.Neutral;
            verticalDirection   = yMotion > 0.0 ? Direction.Positive : yMotion < 0.0 ? Direction.Negative : Direction.Neutral;
        }
Esempio n. 21
0
 private void HandleContactUpdate(object sender, TouchpadEventArgs e)
 {
     ProcessActiveContact(e);
 }