protected internal override GestureDetectorResponse OnTouchEvent(TouchEventCollection touchEvents)
        {
            GestureDetectorResponse result = base.State;
            TouchEvent primaryTouchEvent   = touchEvents.PrimaryTouchEvent;

            if (base.State != GestureDetectorResponse.None && this.downID != primaryTouchEvent.FingerID)
            {
                return(result);
            }
            switch (primaryTouchEvent.Type)
            {
            case TouchEventType.Up:
            {
                Vector2 worldPosition = primaryTouchEvent.WorldPosition;
                float   num           = this.downPos.Distance(worldPosition);
                float   num2          = (float)(primaryTouchEvent.Time - this.downTime).TotalMilliseconds;
                if (num <= this.MaxDistance && num2 <= this.MaxPressDuration)
                {
                    if (this.TapDetected != null)
                    {
                        TapEventArgs tapEventArgs = new TapEventArgs(base.TargetWidget, primaryTouchEvent.WorldPosition, primaryTouchEvent.LocalPosition);
                        this.TapDetected.Invoke(this, tapEventArgs);
                    }
                    result = GestureDetectorResponse.DetectedAndStop;
                }
                else
                {
                    result = GestureDetectorResponse.FailedAndStop;
                }
                break;
            }

            case TouchEventType.Down:
                this.downID   = primaryTouchEvent.FingerID;
                this.downPos  = primaryTouchEvent.WorldPosition;
                this.downTime = primaryTouchEvent.Time;
                result        = GestureDetectorResponse.UndetectedAndContinue;
                break;
            }
            return(result);
        }
Beispiel #2
0
        protected internal override void OnTouchEvent(TouchEventCollection touchEvents)
        {
            base.OnTouchEvent(touchEvents);
            TouchEvent primaryTouchEvent = touchEvents.PrimaryTouchEvent;

            if (primaryTouchEvent.Type == TouchEventType.Down)
            {
                this.animation         = false;
                this.startPos          = this.panelContainer.X;
                this.touchDownLocalPos = primaryTouchEvent.LocalPosition.X;
                this.state             = PagePanel.AnimationState.None;
            }
            if (primaryTouchEvent.Type == TouchEventType.Up && this.state != PagePanel.AnimationState.Flick)
            {
                this.ScrollTo(this.pageIndex, true);
            }
            if (this.state != PagePanel.AnimationState.Drag && this.state != PagePanel.AnimationState.Flick)
            {
                touchEvents.Forward = true;
            }
        }
Beispiel #3
0
        protected internal override void OnTouchEvent(TouchEventCollection touchEvents)
        {
            base.OnTouchEvent(touchEvents);
            TouchEvent primaryTouchEvent = touchEvents.PrimaryTouchEvent;

            if (this.state != PopupList.ButtonState.Disabled)
            {
                switch (primaryTouchEvent.Type)
                {
                case TouchEventType.Up:
                    if (this.state == PopupList.ButtonState.Pressed)
                    {
                        this.ShowDialog();
                        return;
                    }
                    this.updateState(PopupList.ButtonState.Normal);
                    return;

                case TouchEventType.Down:
                    this.updateState(PopupList.ButtonState.Pressed);
                    return;

                case TouchEventType.Move:
                    break;

                case TouchEventType.Enter:
                    this.updateState(PopupList.ButtonState.Pressed);
                    return;

                case TouchEventType.Leave:
                    this.updateState(PopupList.ButtonState.Normal);
                    break;

                default:
                    return;
                }
            }
        }
Beispiel #4
0
        protected internal override void OnTouchEvent(TouchEventCollection touchEvents)
        {
            base.OnTouchEvent(touchEvents);
            TouchEvent primaryTouchEvent = touchEvents.PrimaryTouchEvent;

            if (primaryTouchEvent.Type == TouchEventType.Down)
            {
                this.animation = false;
            }
            else if (primaryTouchEvent.Type == TouchEventType.Up)
            {
                if (this.animationState == LiveFlipPanel.AnimationState.Drag)
                {
                    this.totalTime    = 0f;
                    this.endAngle     = (float)Math.Round((double)(this.angle / 3.14159274f)) * 3.14159274f;
                    this.flipEndAngle = this.angle;
                    if (this.isUseSprite)
                    {
                        this.setupSprite();
                    }
                    this.isStopAnimate = true;
                    this.animation     = true;
                }
                else if (this.animationState == LiveFlipPanel.AnimationState.Flip)
                {
                    this.animation = true;
                    this.Stop(true);
                }
                else if (this.animationState == LiveFlipPanel.AnimationState.FlickFlip)
                {
                    this.animationState = LiveFlipPanel.AnimationState.Flip;
                }
            }
            if (this.animationState != LiveFlipPanel.AnimationState.None)
            {
                touchEvents.Forward = true;
            }
        }
        protected internal override GestureDetectorResponse OnTouchEvent(TouchEventCollection touchEvents)
        {
            GestureDetectorResponse result = base.State;
            TouchEvent primaryTouchEvent   = touchEvents.PrimaryTouchEvent;

            if (base.State != GestureDetectorResponse.None && this.downID != primaryTouchEvent.FingerID)
            {
                return(result);
            }
            switch (primaryTouchEvent.Type)
            {
            case TouchEventType.Up:
                if (this.DragEndDetected != null)
                {
                    DragEventArgs dragEventArgs = new DragEventArgs(base.TargetWidget, primaryTouchEvent.WorldPosition, primaryTouchEvent.LocalPosition, primaryTouchEvent.WorldPosition - this.previousWorldPosition);
                    this.DragEndDetected.Invoke(this, dragEventArgs);
                }
                this.previousWorldPosition = primaryTouchEvent.WorldPosition;
                result = GestureDetectorResponse.FailedAndStop;
                break;

            case TouchEventType.Down:
                this.downID = primaryTouchEvent.FingerID;
                this.previousWorldPosition = primaryTouchEvent.WorldPosition;
                result = GestureDetectorResponse.UndetectedAndContinue;
                break;

            case TouchEventType.Move:
                if (base.State == GestureDetectorResponse.UndetectedAndContinue)
                {
                    Vector2 worldPosition = primaryTouchEvent.WorldPosition;
                    float   num           = this.previousWorldPosition.Distance(worldPosition);
                    if (num >= this.MaxDistance)
                    {
                        DragEventArgs dragEventArgs2 = new DragEventArgs(base.TargetWidget, primaryTouchEvent.WorldPosition, primaryTouchEvent.LocalPosition, primaryTouchEvent.WorldPosition - this.previousWorldPosition);
                        this.previousWorldPosition = primaryTouchEvent.WorldPosition;
                        if (this.DragStartDetected != null)
                        {
                            this.DragStartDetected.Invoke(this, dragEventArgs2);
                        }
                        if (this.DragDetected != null)
                        {
                            this.DragDetected.Invoke(this, dragEventArgs2);
                        }
                        result = GestureDetectorResponse.DetectedAndContinue;
                    }
                }
                else
                {
                    if (this.DragDetected != null)
                    {
                        DragEventArgs dragEventArgs3 = new DragEventArgs(base.TargetWidget, primaryTouchEvent.WorldPosition, primaryTouchEvent.LocalPosition, primaryTouchEvent.WorldPosition - this.previousWorldPosition);
                        this.DragDetected.Invoke(this, dragEventArgs3);
                    }
                    this.previousWorldPosition = primaryTouchEvent.WorldPosition;
                    result = GestureDetectorResponse.DetectedAndContinue;
                }
                break;
            }
            return(result);
        }
        protected internal override GestureDetectorResponse OnTouchEvent(TouchEventCollection touchEvents)
        {
            GestureDetectorResponse result = base.State;
            TouchEventCollection    touchEventCollection = new TouchEventCollection();

            foreach (TouchEvent touchEvent in touchEvents)
            {
                if (touchEvent.Type != TouchEventType.Enter && touchEvent.Type != TouchEventType.Leave && touchEvent.Type != TouchEventType.None)
                {
                    touchEventCollection.Add(touchEvent);
                }
            }
            if (touchEventCollection.Count >= 2)
            {
                bool      flag   = false;
                Vector2[] array  = new Vector2[2];
                Vector2[] array2 = new Vector2[2];
                for (int i = 0; i < 2; i++)
                {
                    TouchEvent touchEvent2 = touchEventCollection[i];
                    array[i]  = touchEvent2.LocalPosition;
                    array2[i] = touchEvent2.WorldPosition;
                    if (touchEvent2.Type == TouchEventType.Up)
                    {
                        flag = true;
                    }
                }
                float num = array[0].Distance(array[1]);
                if (this.firstDistance < 0f)
                {
                    this.firstDistance    = num;
                    this.firstTouchVector = array[1] - array[0];
                }
                if (base.State == GestureDetectorResponse.UndetectedAndContinue || base.State == GestureDetectorResponse.None)
                {
                    if (FMath.Abs(num - this.firstDistance) > this.MinPinchDistance)
                    {
                        Vector2 localCenter = (array[0] + array[1]) / 2f;
                        Vector2 worldCenter = (array2[0] + array2[1]) / 2f;
                        if (this.PinchStartDetected != null)
                        {
                            this.PinchStartDetected.Invoke(this, new PinchEventArgs(base.TargetWidget, num, 1f, 0f, worldCenter, localCenter));
                        }
                        result = GestureDetectorResponse.DetectedAndContinue;
                    }
                    else
                    {
                        result = GestureDetectorResponse.UndetectedAndContinue;
                    }
                }
                else if (base.State == GestureDetectorResponse.DetectedAndContinue)
                {
                    Vector2 vector       = array[1] - array[0];
                    float   scale        = num / this.firstDistance;
                    float   angle        = this.firstTouchVector.Angle(vector);
                    Vector2 localCenter2 = (array[0] + array[1]) / 2f;
                    Vector2 worldCenter2 = (array2[0] + array2[1]) / 2f;
                    if (flag)
                    {
                        if (this.PinchEndDetected != null)
                        {
                            this.PinchEndDetected.Invoke(this, new PinchEventArgs(base.TargetWidget, num, scale, angle, worldCenter2, localCenter2));
                        }
                        result                = GestureDetectorResponse.DetectedAndStop;
                        this.firstDistance    = -1f;
                        this.firstTouchVector = Vector2.Zero;
                    }
                    else
                    {
                        if (this.PinchDetected != null)
                        {
                            this.PinchDetected.Invoke(this, new PinchEventArgs(base.TargetWidget, num, scale, angle, worldCenter2, localCenter2));
                        }
                        result = GestureDetectorResponse.DetectedAndContinue;
                    }
                }
            }
            else if (base.State == GestureDetectorResponse.DetectedAndContinue)
            {
                result = GestureDetectorResponse.FailedAndStop;
            }
            else
            {
                result = GestureDetectorResponse.UndetectedAndContinue;
            }
            return(result);
        }
Beispiel #7
0
        protected internal override void OnTouchEvent(TouchEventCollection touchEvents)
        {
            base.OnTouchEvent(touchEvents);
            TouchEvent primaryTouchEvent = touchEvents.PrimaryTouchEvent;

            if (primaryTouchEvent.Type == TouchEventType.Down)
            {
                this.animation = false;
                Matrix4 transform3D = this.spherePrim.Transform3D;
                transform3D.M43             = this.radius * 0.2f;
                this.spherePrim.Transform3D = transform3D;
                return;
            }
            if (primaryTouchEvent.Type == TouchEventType.Enter)
            {
                Matrix4 transform3D2 = this.spherePrim.Transform3D;
                transform3D2.M43            = this.radius * 0.2f;
                this.spherePrim.Transform3D = transform3D2;
                return;
            }
            if (primaryTouchEvent.Type == TouchEventType.Leave)
            {
                Matrix4 transform3D3 = this.spherePrim.Transform3D;
                transform3D3.M43            = 0f;
                this.spherePrim.Transform3D = transform3D3;
                return;
            }
            if (primaryTouchEvent.Type == TouchEventType.Up)
            {
                Matrix4 transform3D4 = this.spherePrim.Transform3D;
                transform3D4.M43            = 0f;
                this.spherePrim.Transform3D = transform3D4;
                if (this.animationState == LiveSphere.AnimationState.None && !this.animation)
                {
                    if (this.ButtonAction != null)
                    {
                        this.ButtonAction.Invoke(this, new TouchEventArgs(touchEvents));
                        return;
                    }
                }
                else
                {
                    if (this.animationState == LiveSphere.AnimationState.Drag)
                    {
                        this.totalTime     = 0f;
                        this.endAngle      = (float)Math.Round((double)(this.yAxis / 3.14159274f)) * 3.14159274f;
                        this.flipEndAngle  = this.yAxis;
                        this.isStopAnimate = true;
                        this.animation     = true;
                        return;
                    }
                    if (this.animationState == LiveSphere.AnimationState.Flip)
                    {
                        this.animation = true;
                        this.Stop(true);
                        return;
                    }
                    if (this.animationState == LiveSphere.AnimationState.FlickFlip)
                    {
                        this.animationState = LiveSphere.AnimationState.Flip;
                    }
                }
            }
        }
        protected internal override GestureDetectorResponse OnTouchEvent(TouchEventCollection touchEvents)
        {
            GestureDetectorResponse result = base.State;
            TouchEvent primaryTouchEvent   = touchEvents.PrimaryTouchEvent;

            if (base.State != GestureDetectorResponse.None && this.firstDownID != primaryTouchEvent.FingerID)
            {
                return(result);
            }
            Vector2 worldPosition = primaryTouchEvent.WorldPosition;
            float   num           = this.firstDownPos.Distance(worldPosition);
            float   num2          = (float)(primaryTouchEvent.Time - this.previousTime).TotalMilliseconds;

            switch (primaryTouchEvent.Type)
            {
            case TouchEventType.Up:
                if (this.downCount == 2)
                {
                    if (num <= this.MaxDistance && num2 <= this.MaxPressDuration)
                    {
                        if (this.DoubleTapDetected != null)
                        {
                            DoubleTapEventArgs doubleTapEventArgs = new DoubleTapEventArgs(base.TargetWidget, primaryTouchEvent.WorldPosition, primaryTouchEvent.LocalPosition);
                            this.DoubleTapDetected.Invoke(this, doubleTapEventArgs);
                        }
                        result = GestureDetectorResponse.DetectedAndStop;
                    }
                    else
                    {
                        result = GestureDetectorResponse.FailedAndStop;
                    }
                }
                else if (num <= this.MaxDistance && num2 <= this.MaxPressDuration)
                {
                    this.previousTime = primaryTouchEvent.Time;
                    result            = GestureDetectorResponse.UndetectedAndContinue;
                }
                else
                {
                    result = GestureDetectorResponse.FailedAndStop;
                }
                break;

            case TouchEventType.Down:
                if (this.downCount > 0)
                {
                    if (num <= this.MaxDistance && num2 <= this.MaxNextPressDuration)
                    {
                        this.downCount++;
                        this.previousTime = primaryTouchEvent.Time;
                    }
                    else
                    {
                        this.OnResetState();
                    }
                }
                if (this.downCount == 0)
                {
                    this.downCount++;
                    this.firstDownID  = primaryTouchEvent.FingerID;
                    this.firstDownPos = primaryTouchEvent.WorldPosition;
                    this.previousTime = primaryTouchEvent.Time;
                }
                result = GestureDetectorResponse.UndetectedAndContinue;
                break;
            }
            return(result);
        }
        protected internal override GestureDetectorResponse OnTouchEvent(TouchEventCollection touchEvents)
        {
            GestureDetectorResponse result = base.State;
            TouchEvent primaryTouchEvent   = touchEvents.PrimaryTouchEvent;

            if (base.State != GestureDetectorResponse.None && this.downID != primaryTouchEvent.FingerID)
            {
                return(result);
            }
            switch (primaryTouchEvent.Type)
            {
            case TouchEventType.Up:
            {
                Vector2 vector = primaryTouchEvent.WorldPosition - this.previousWorldPosition[1];
                float   num    = (float)(primaryTouchEvent.Time - this.previousTime[1]).TotalMilliseconds;
                Vector2 zero   = Vector2.Zero;
                if (this.Direction != FlickDirection.Virtical)
                {
                    zero.X = vector.X / num * 1000f;
                    if (zero.X < -this.MaxSpeed)
                    {
                        zero.X = -this.MaxSpeed;
                    }
                    else if (zero.X > this.MaxSpeed)
                    {
                        zero.X = this.MaxSpeed;
                    }
                    else if (Math.Abs(zero.X) < this.MinSpeed)
                    {
                        zero.X = 0f;
                    }
                }
                if (this.Direction != FlickDirection.Horizontal)
                {
                    zero.Y = vector.Y / num * 1000f;
                    if (zero.Y < -this.MaxSpeed)
                    {
                        zero.Y = -this.MaxSpeed;
                    }
                    else if (this.MaxSpeed < zero.Y)
                    {
                        zero.Y = this.MaxSpeed;
                    }
                    else if (Math.Abs(zero.Y) < this.MinSpeed)
                    {
                        zero.Y = 0f;
                    }
                }
                if (zero.X != 0f || zero.Y != 0f)
                {
                    if (this.FlickDetected != null)
                    {
                        FlickEventArgs flickEventArgs = new FlickEventArgs(base.TargetWidget, primaryTouchEvent.WorldPosition, primaryTouchEvent.LocalPosition, zero);
                        this.FlickDetected.Invoke(this, flickEventArgs);
                    }
                    result = GestureDetectorResponse.DetectedAndStop;
                }
                else
                {
                    result = GestureDetectorResponse.FailedAndStop;
                }
                break;
            }

            case TouchEventType.Down:
                this.downID = primaryTouchEvent.FingerID;
                for (int i = 0; i < 2; i++)
                {
                    this.previousWorldPosition[i] = primaryTouchEvent.WorldPosition;
                    this.previousTime[i]          = primaryTouchEvent.Time;
                }
                result = GestureDetectorResponse.UndetectedAndContinue;
                break;

            case TouchEventType.Move:
                if ((primaryTouchEvent.Time - this.previousTime[0]).TotalMilliseconds > (double)this.pollingMilliseconds)
                {
                    this.previousWorldPosition[1] = this.previousWorldPosition[0];
                    this.previousTime[1]          = this.previousTime[0];
                    this.previousWorldPosition[0] = primaryTouchEvent.WorldPosition;
                    this.previousTime[0]          = primaryTouchEvent.Time;
                    result = GestureDetectorResponse.UndetectedAndContinue;
                }
                break;
            }
            return(result);
        }
 public bool Contains(TouchEvent touchEvent)
 {
     return(base.List.Contains(touchEvent));
 }
 public void Remove(TouchEvent touchEvent)
 {
     base.List.Remove(touchEvent);
 }
 public int IndexOf(TouchEvent touchEvent)
 {
     return(base.List.IndexOf(touchEvent));
 }
 public void Insert(int index, TouchEvent touchEvent)
 {
     base.List.Insert(index, touchEvent);
 }
 public int Add(TouchEvent touchEvent)
 {
     return(base.List.Add(touchEvent));
 }