//*********************************************************************************************************************** //*********************************************************************************************************************** /// <summary> /// /// </summary> /// <param name="Args"></param> //----------------------------------------------------------------------------------------------------------------------- private void NotifyMove(InputDeltaArgs Args) { //------------------------------------------------------------------------------------------------------------------- if ((Math.Abs(Args.CumulativeTranslation.X) > this.DeadZoneInPixels.Width) || (Math.Abs(Args.CumulativeTranslation.Y) > this.DeadZoneInPixels.Height)) { //--------------------------------------------------------------------------------------------------------------- this.GestureManipulation = Args.Origin; if (!this.Dragging) { this.ReleaseMouseCaptureAtGestureOrigin(); } this.Dragging = true; //--------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------- if (this.DragLockValue == DragLock.Unset) { //----------------------------------------------------------------------------------------------------------- double Value = AngleFromVector(Args.CumulativeTranslation.X, Args.CumulativeTranslation.Y) % 180.0; //----------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------- if ((Value <= 45.0) || (Value >= 135.0)) { this.DragLockValue = DragLock.Horizontal; } //----------------------------------------------------------------------------------------------------------- else if ((Value > 45.0) && (Value < 135.0)) { this.DragLockValue = DragLock.Vertical; } //----------------------------------------------------------------------------------------------------------- else { this.DragLockValue = DragLock.Free; } //----------------------------------------------------------------------------------------------------------- } //--------------------------------------------------------------------------------------------------------------- } //------------------------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------------------------- if (this.Dragging) { this.RaiseDragEvents(Args); } //------------------------------------------------------------------------------------------------------------------- }
//*********************************************************************************************************************** //*********************************************************************************************************************** /// <summary> /// Initialise une nouvelle instance de l'objet <b>DragEventArgs</b>. /// </summary> /// <param name="Args">Evénement d'origine.</param> //----------------------------------------------------------------------------------------------------------------------- internal DragEventArgs(InputDeltaArgs Args) { //------------------------------------------------------------------------------------------------------------------- if (Args != null) { //--------------------------------------------------------------------------------------------------------------- this.CumulativeDistance = Args.CumulativeTranslation; this.DeltaDistance = Args.DeltaTranslation; this.Origin = Args.Origin; //--------------------------------------------------------------------------------------------------------------- } //------------------------------------------------------------------------------------------------------------------- }
//*********************************************************************************************************************** //*********************************************************************************************************************** /// <summary> /// /// </summary> /// <param name="Args"></param> //----------------------------------------------------------------------------------------------------------------------- private void RaiseDragEvents(InputDeltaArgs Args) { //------------------------------------------------------------------------------------------------------------------- DragEventArgs NewArgs = new DragEventArgs(Args); //------------------------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------------------------- if (Args.DeltaTranslation.X != 0.0 && this.DragLockValue == DragLock.Horizontal) { this.RaiseHorizontalDrag(NewArgs); } //------------------------------------------------------------------------------------------------------------------- else if (Args.DeltaTranslation.Y != 0.0 && this.DragLockValue == DragLock.Vertical) { this.RaiseVerticalDrag(NewArgs); } //------------------------------------------------------------------------------------------------------------------- }