protected virtual GestureEnd EndMove(bool isInertial, ManipulationDelta cumulative, ManipulationVelocities velocities, Point position) { this.dragLock = DragLock.Unset; this.dragging = false; double angle = 0.0; if (isInertial) { #if !WINDOWS_PHONE angle = GestureService.AngleFromVector(velocities.Linear.X, velocities.Linear.Y); #else angle = GestureService.AngleFromVector(velocities.LinearVelocity.X, velocities.LinearVelocity.Y); #endif if (angle <= 45.0 || angle >= 315.0) { angle = 0.0; } else if (angle >= 135.0 && angle <= 225.0) { angle = 180.0; } this.ReleaseMouseCaptureAtGestureOrigin(); } return(new GestureEnd(angle, isInertial, cumulative.Translation, position)); }
private DragLock GetDragLockForMove(ManipulationDelta cumulative) { if (!this.dragging) { this.ReleaseMouseCaptureAtGestureOrigin(); } this.dragging = true; if (this.dragLock == DragLock.Unset) { double num = GestureService.AngleFromVector(cumulative.Translation.X, cumulative.Translation.Y) % 180.0; this.dragLock = num <= 45.0 || num >= 135.0 ? DragLock.Horizontal : DragLock.Vertical; } return(this.dragLock); }