Esempio n. 1
0
        internal override void Update(GameTime gameTime)
        {
            var touchCollection = TouchPanel.GetState();

            foreach (var touchLocation in touchCollection)
            {
                switch (touchLocation.State)
                {
                case TouchLocationState.Pressed:
                    TouchStarted.Raise(this, new TouchEventArgs(touchLocation));
                    break;

                case TouchLocationState.Moved:
                    TouchMoved.Raise(this, new TouchEventArgs(touchLocation));
                    break;

                case TouchLocationState.Released:
                    TouchEnded.Raise(this, new TouchEventArgs(touchLocation));
                    break;

                case TouchLocationState.Invalid:
                    TouchCancelled.Raise(this, new TouchEventArgs(touchLocation));
                    break;
                }
            }
        }
Esempio n. 2
0
        public override void Update(GameTime gameTime)
        {
            var touchCollection = TouchPanel.GetState();

            foreach (var touchLocation in touchCollection)
            {
                switch (touchLocation.State)
                {
                case TouchLocationState.Pressed:
                    TouchStarted?.Invoke(this, new TouchEventArgs(ViewportAdapter, gameTime.TotalGameTime, touchLocation));
                    break;

                case TouchLocationState.Moved:
                    TouchMoved?.Invoke(this, new TouchEventArgs(ViewportAdapter, gameTime.TotalGameTime, touchLocation));
                    break;

                case TouchLocationState.Released:
                    TouchEnded?.Invoke(this, new TouchEventArgs(ViewportAdapter, gameTime.TotalGameTime, touchLocation));
                    break;

                case TouchLocationState.Invalid:
                    TouchCancelled?.Invoke(this, new TouchEventArgs(ViewportAdapter, gameTime.TotalGameTime, touchLocation));
                    break;
                }
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Manages the listener logic
        /// </summary>
        /// <param name="gameTime"></param>
        public void Update(GameTime gameTime)
        {
            var touchCollection = TouchPanel.GetState();

            foreach (var touchLocation in touchCollection)
            {
                switch (touchLocation.State)
                {
                case TouchLocationState.Pressed:
                    TouchStarted?.Invoke(this, new TouchEventArgs(_screenTransformationMatrixProvider, gameTime.TotalGameTime, touchLocation));
                    break;

                case TouchLocationState.Moved:
                    TouchMoved?.Invoke(this, new TouchEventArgs(_screenTransformationMatrixProvider, gameTime.TotalGameTime, touchLocation));
                    break;

                case TouchLocationState.Released:
                    TouchEnded?.Invoke(this, new TouchEventArgs(_screenTransformationMatrixProvider, gameTime.TotalGameTime, touchLocation));
                    break;

                case TouchLocationState.Invalid:
                    TouchCancelled?.Invoke(this, new TouchEventArgs(_screenTransformationMatrixProvider, gameTime.TotalGameTime, touchLocation));
                    break;
                }
            }
        }
        public override void TouchesEnded(Foundation.NSSet touches, UIEvent evt)
        {
            base.TouchesEnded(touches, evt);

            var touch = touches.AnyObject as UITouch;

            if (touch != null)
            {
                TouchEnded?.Invoke(this, touch);
            }
        }
Esempio n. 5
0
        /// <summary>
        /// Called, when mouse/finger/pen anymore click/touch map
        /// </summary>
        /// <param name="touchPoints">List of all touched points</param>
        /// <param name="releasedPoint">Released point, which was touched before</param>
        private bool OnTouchEnd(List <Geometries.Point> touchPoints, Geometries.Point releasedPoint)
        {
            var args = new TouchedEventArgs(touchPoints);

            TouchEnded?.Invoke(this, args);

            // Last touch released
            if (touchPoints.Count == 0)
            {
                _mode = TouchMode.None;
                _map.RefreshData(_viewport.Extent, _viewport.Resolution, true);
            }

            return(args.Handled);
        }
Esempio n. 6
0
        /// <summary>
        /// Called, when mouse/finger/pen anymore click/touch map
        /// </summary>
        /// <param name="touchPoints">List of all touched points</param>
        /// <param name="releasedPoint">Released point, which was touched before</param>
        private bool OnTouchEnd(List <Geometries.Point> touchPoints, Geometries.Point releasedPoint)
        {
            var args = new TouchedEventArgs(touchPoints);

            TouchEnded?.Invoke(this, args);

            // Last touch released
            if (touchPoints.Count == 0)
            {
                InvalidateCanvas();
                _mode = TouchMode.None;
                _map.ViewChanged(true);
            }

            return(args.Handled);
        }
Esempio n. 7
0
        internal void HandleTouchEnd(TouchState touch)
        {
            if (isRemoved || !IsTouchEnabled())
            {
                return;
            }

            if (!HasTouch(touch.id))
            {
                return;
            }

            _touches.RemoveAt(GetTouchIndex(touch.id));
            TouchEnded.Dispatch(this, touch);
            isPressed = _touches.Count > 0;
        }
Esempio n. 8
0
 public void StopTouchCapture()
 {
     EnsureNotDisposed();
     if (!_acquired)
     {
         return;
     }
     _device.OnPacket -= OnDevicePacket;
     _device.Unacquire();
     _acquired = false;
     if (_touching)
     {
         TouchEnded?.Invoke(this, EventArgs.Empty);
         _touching = false;
     }
 }
Esempio n. 9
0
        private void TouchEnds(Touch touch, int index)
        {
            if (_touches.ContainsKey(index))
            {
                var endPosition = touch.position;
                var totalDelta  = endPosition - _touches[index];
                if (TouchEnded != null)
                {
                    TouchEnded.Invoke(totalDelta);
                    if (_touchParticles != null)
                    {
                        var normalizedDelta = totalDelta.normalized;
                        _touchParticles.transform.position = Camera.main.ScreenToWorldPoint(new Vector3(endPosition.x, endPosition.y, 0f) + Vector3.up * 11f);
                        _touchParticles.transform.LookAt(_touchParticles.transform.position + new Vector3(normalizedDelta.x, 0, normalizedDelta.y));

                        _touchParticles.Emit(52);
                    }
                }
            }
        }
Esempio n. 10
0
        public override void Update(GameTime gameTime)
        {
            var touchCollection = TouchPanel.GetState();

            if (TouchPanel.IsGestureAvailable)
            {
                var gesture = TouchPanel.ReadGesture();
                if (gesture.GestureType == GestureType.Tap)
                {
                    int x = 0;
                }
                if (gesture.GestureType == GestureType.DoubleTap)
                {
                    int y = 0;
                }
            }

            foreach (var touchLocation in touchCollection)
            {
                switch (touchLocation.State)
                {
                case TouchLocationState.Pressed:
                    TouchStarted?.Invoke(this, new TouchEventArgs(ViewportAdapter, gameTime.TotalGameTime, touchLocation));
                    break;

                case TouchLocationState.Moved:
                    TouchMoved?.Invoke(this, new TouchEventArgs(ViewportAdapter, gameTime.TotalGameTime, touchLocation));
                    break;

                case TouchLocationState.Released:
                    TouchEnded?.Invoke(this, new TouchEventArgs(ViewportAdapter, gameTime.TotalGameTime, touchLocation));
                    break;

                case TouchLocationState.Invalid:
                    TouchCancelled?.Invoke(this, new TouchEventArgs(ViewportAdapter, gameTime.TotalGameTime, touchLocation));
                    break;
                }
            }
        }
Esempio n. 11
0
 /// <summary>
 /// Protected overridable handler that raises TouchEnded event.
 /// </summary>
 protected virtual void OnTouchEnded(TouchEventArgs args)
 {
     TouchEnded?.Invoke(this, args);
 }
 public void OnTouchEnded(double positionX, double positionY)
 {
     TouchEnded?.Invoke(Content, new PositionEventArgs(positionX, positionY));
 }
Esempio n. 13
0
 protected void SingleTouchEnded()
 {
     TouchEnded?.Invoke(FirstTouch);
 }
Esempio n. 14
0
 protected virtual void OnTouchEnded(ITouchEventArgs e) =>
 TouchEnded?.Invoke(this, e);