Paint.ToolBoxToolTouchBase.CheckTouchCollision C# (CSharp) Méthode

CheckTouchCollision() public méthode

Checks wheter a particular touch point (user pressing the screen) is within the bounds of this control.
public CheckTouchCollision ( ITouchPoint touch ) : bool
touch ITouchPoint
Résultat bool
        public bool CheckTouchCollision(ITouchPoint touch)
        {
            if (this.Bounds.Contains(touch.Position))
            {
                if (touch.TouchType == TouchType.FreeDrag && inDragMode == false)
                {
                    // although the drag is in this control, it did not start here so we are ignoring it
                    return false;
                }

                switch (touch.TouchType)
                {
                    case TouchType.StartDrag:
                        this.inDragMode = true;
                        break;

                    case TouchType.DragComplete:
                        this.inDragMode = false;
                        break;
                }
            }
            else if (this.inDragMode == true)
            {
                // we are in drag mode, although the user has dragged outside this control
                if (touch.TouchType == TouchType.DragComplete)
                {
                    this.inDragMode = false;
                }
            }
            else
            {
                return false;
            }

            this.HandleTouch(touch);

            return true;
        }