Ejemplo n.º 1
0
        //***********************************************************************************************************************

        //***********************************************************************************************************************
        /// <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);
            }
            //-------------------------------------------------------------------------------------------------------------------
        }
Ejemplo n.º 2
0
        //***********************************************************************************************************************

        //***********************************************************************************************************************
        /// <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;
                //---------------------------------------------------------------------------------------------------------------
            }
            //-------------------------------------------------------------------------------------------------------------------
        }
Ejemplo n.º 3
0
        //***********************************************************************************************************************

        //***********************************************************************************************************************
        /// <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);
            }
            //-------------------------------------------------------------------------------------------------------------------
        }