public DragEventArgs(InputDeltaArgs args) { if (args != null) { CumulativeDistance = args.CumulativeTranslation; DeltaDistance = args.DeltaTranslation; } }
protected void NotifyMove(InputDeltaArgs args) { if (Math.Abs(args.CumulativeTranslation.X) > DeadZoneInPixels.Width || Math.Abs(args.CumulativeTranslation.Y) > DeadZoneInPixels.Height) { if (!_dragging) { ReleaseMouseCaptureAtGestureOrigin(); } _dragging = true; if (_dragLock == DragLock.Unset) { double angle = GestureHelper.AngleFromVector(args.CumulativeTranslation.X, args.CumulativeTranslation.Y) % 180; _dragLock = angle <= 45 || angle >= 135 ? DragLock.Horizontal : DragLock.Vertical; } } if (_dragging) { RaiseDragEvents(args); } }
private void RaiseDragEvents(InputDeltaArgs args) { DragEventArgs e = new DragEventArgs(args); if (args.DeltaTranslation.X != 0 && _dragLock == DragLock.Horizontal) { RaiseHorizontalDrag(e); } else if (args.DeltaTranslation.Y != 0 && _dragLock == DragLock.Vertical) { RaiseVerticalDrag(e); } }