コード例 #1
0
        public virtual bool Consume(TouchInfo touchInfo)
        {
            if (blockInput)
            {
                return(true);
            }

            UIElement toConsume = null;

            if (overlay != null)
            {
                toConsume = overlay.GetConsumedElement(touchInfo);
            }
            else
            {
                toConsume = CurrentPage.GetConsumedElement(touchInfo);
            }

            if (touchInfo.TouchState == TouchState.Released)
            {
                touchInfo.Delta = touchInfo.Position - lastPressPos;
                if (draggedObject != null)
                {
                    toConsume     = draggedObject;
                    draggedObject = null;
                }
            }
            else if (touchInfo.TouchState == TouchState.Pressed)
            {
                if (draggedObject == null)
                {
                    draggedObject = toConsume;
                    lastPressPos.Copy(touchInfo.Position);
                }
            }
            else if (touchInfo.TouchState == TouchState.Moved)
            {
                if (draggedObject != null)
                {
                    toConsume = draggedObject;
                }
                touchInfo.Delta = touchInfo.Position - lastPressPos;
            }

            if (toConsume == null)
            {
                return(overlay != null);
            }
            toConsume.Consume(touchInfo);
            return(true);
        }
コード例 #2
0
 public void Copy(TouchInfo ti)
 {
     id = ti.id;
     Position.Copy(ti.Position);
     TouchState = ti.TouchState;
 }