Example #1
0
        /// <summary>
        ///     Provides all of the known points the device hit since the last reported position update.
        /// </summary>
        /// <param name="relativeTo">Defines the coordinate space.</param>
        /// <returns>A list of points in the coordinate space of relativeTo.</returns>
        public override TouchPointCollection GetIntermediateTouchPoints(IInputElement relativeTo)
        {
            // Retrieve the stylus points
            StylusPointCollection stylusPoints = StylusDevice.GetStylusPoints(relativeTo, _stylusPointDescription);
            int count = stylusPoints.Count;
            TouchPointCollection touchPoints = new TouchPointCollection();

            GeneralTransform elementToRoot;
            GeneralTransform rootToElement;

            GetRootTransforms(relativeTo, out elementToRoot, out rootToElement);

            // Convert the stylus points into touch points
            for (int i = 0; i < count; i++)
            {
                StylusPoint stylusPoint = stylusPoints[i];
                Point       position    = new Point(stylusPoint.X, stylusPoint.Y);
                Rect        rectBounds  = GetBounds(stylusPoint, position, relativeTo, elementToRoot, rootToElement);

                TouchPoint touchPoint = new TouchPoint(this, position, rectBounds, _lastAction);
                touchPoints.Add(touchPoint);
            }

            return(touchPoints);
        }
Example #2
0
        internal static TouchPointCollection GetTouchPoints(IInputElement relativeTo)
        {
            TouchPointCollection points = new TouchPointCollection();

            if (_activeDevices != null)
            {
                int count = _activeDevices.Count;
                for (int i = 0; i < count; i++)
                {
                    TouchDevice device = _activeDevices[i];
                    points.Add(device.GetTouchPoint(relativeTo));
                }
            }

            return(points);
        }