public async void FireOnTouchCancel()
 {
     if (OnTouchCancel != null)
     {
         OnTouchCancel.Invoke("OnTouchCancel", new System.EventArgs());
     }
     await this.ScaleTo(1, 50);
 }
Beispiel #2
0
    public static void Update()
    {
        if (Input.touchCount != TouchCount && OnTouchCountChanged != null)
        {
            TouchCount = Input.touchCount;
            OnTouchCountChanged();
        }

        if (Input.touchCount > 0)
        {
            for (int i = 0; i < Input.touchCount; ++i)
            {
                Touch     currentTouch = Input.touches[i];
                TouchInfo touchInfo    = GetTouchInfo(currentTouch);

                if (touchInfo == null)
                {
                    touchInfos.Add(new TouchInfo(currentTouch));
                }
                else
                {
                    touchInfo.UpdateInfo(currentTouch);
                }

                switch (currentTouch.phase)
                {
                case TouchPhase.Began:
                    OnTouchStart?.Invoke(touchInfo);
                    break;

                case TouchPhase.Stationary:
                    OnTouchHold?.Invoke(touchInfo);
                    break;

                case TouchPhase.Moved:
                    OnTouchMove?.Invoke(touchInfo);
                    break;

                case TouchPhase.Ended:
                    touchInfos.Remove(touchInfo);
                    OnTouchEnd?.Invoke(touchInfo);
                    break;

                case TouchPhase.Canceled:
                    touchInfos.Remove(touchInfo);
                    OnTouchCancel?.Invoke(touchInfo);
                    break;

                default:
                    continue;
                }
            }
        }
    }
        internal void DispatchEvent(Map map, MapJsEventArgs eventArgs)
        {
            switch (eventArgs.Type)
            {
            case "click":
                OnClick?.Invoke(new MapMouseEventArgs(map, eventArgs));
                break;

            case "contextmenu":
                OnContextMenu?.Invoke(new MapMouseEventArgs(map, eventArgs));
                break;

            case "dblclick":
                OnDblClick?.Invoke(new MapMouseEventArgs(map, eventArgs));
                break;

            case "layeradded":
                OnLayerAdded?.Invoke(new MapEventArgs(map, eventArgs.Type));
                break;

            case "layerremoved":
                OnLayerRemoved?.Invoke(new MapEventArgs(map, eventArgs.Type));
                break;

            case "mousedown":
                OnMouseDown?.Invoke(new MapMouseEventArgs(map, eventArgs));
                break;

            case "mouseenter":
                OnMouseEnter?.Invoke(new MapMouseEventArgs(map, eventArgs));
                break;

            case "mouseleave":
                OnMouseLeave?.Invoke(new MapMouseEventArgs(map, eventArgs));
                break;

            case "mousemove":
                OnMouseMove?.Invoke(new MapMouseEventArgs(map, eventArgs));
                break;

            case "mouseout":
                OnMouseOut?.Invoke(new MapMouseEventArgs(map, eventArgs));
                break;

            case "mouseover":
                OnMouseOver?.Invoke(new MapMouseEventArgs(map, eventArgs));
                break;

            case "mouseup":
                OnMouseUp?.Invoke(new MapMouseEventArgs(map, eventArgs));
                break;

            case "touchcancel":
                OnTouchCancel?.Invoke(new MapTouchEventArgs(map, eventArgs));
                break;

            case "touchend":
                OnTouchEnd?.Invoke(new MapTouchEventArgs(map, eventArgs));
                break;

            case "touchmove":
                OnTouchMove?.Invoke(new MapTouchEventArgs(map, eventArgs));
                break;

            case "touchstart":
                OnTouchStart?.Invoke(new MapTouchEventArgs(map, eventArgs));
                break;

            case "wheel":
                OnWheel?.Invoke(new MapEventArgs(map, eventArgs.Type));
                break;
            }
        }