Exemplo n.º 1
0
 public Gesture(GesturePoint[] points)
 {
     _points = points;
     var first = _points[0];
     var last = _points[_points.Length - 1];
     var duration = last.Time - first.Time;
     Delta = last.Point - first.Point;
     Velocity = new Vector(Delta.X / duration, Delta.Y / duration);
 }
Exemplo n.º 2
0
        /// <inheritdoc/>
        protected override bool TryGetPoint(MouseEventArgs args, out GesturePoint point)
        {
            var inputElement = this.InputElement;

            if (inputElement == null)
            {
                point = default(GesturePoint);
                return(false);
            }

            point = new GesturePoint(args.GetPosition(inputElement), args.Timestamp);
            return(true);
        }
        /// <inheritdoc />
        protected override bool TryGetPoint(TouchEventArgs args, out GesturePoint point)
        {
            if (args is null)
            {
                throw new ArgumentNullException(nameof(args));
            }

            var inputElement = this.InputElement;

            if (inputElement is null)
            {
                point = default;
                return(false);
            }

            point = new GesturePoint(args.GetTouchPoint(inputElement).Position, args.Timestamp);
            return(true);
        }