예제 #1
0
        public override void TouchesBegan(NSSet touches, UIEvent evt)
        {
            swiped = false;

            if (touches.First().GetType() == typeof(UITouch))
            {
                lastPoint = ((UITouch)touches.First()).LocationInView(this);
            }
        }
예제 #2
0
 public override void TouchesMoved(NSSet touches, UIEvent evt)
 {
     swiped = true;
     if (touches.First().GetType() == typeof(UITouch))
     {
         var currentPoint = ((UITouch)touches.First()).LocationInView(this);
         DrawLineFrom(lastPoint, currentPoint);
         lastPoint = currentPoint;
     }
 }
		public override void TouchesBegan (NSSet touches, UIEvent evt)
		{
			CanvasView.DrawTouches (touches, evt);

			if (visualizeAzimuth) {
				ReticleView.Hidden = false;
				UpdateReticleView ((UITouch)touches.First());
			}
		}
예제 #4
0
        public override void TouchesBegan(NSSet touches, UIEvent evt)
        {
            CanvasView.DrawTouches(touches, evt);

            if (visualizeAzimuth)
            {
                ReticleView.Hidden = false;
                UpdateReticleView((UITouch)touches.First());
            }
        }
예제 #5
0
        public SingleFingerGesture(NSSet touches, ARSCNView scnView, VirtualObject lastUsedObject, VirtualObjectManager vom)
            : base(touches, scnView, lastUsedObject, vom)
        {
            var firstTouch = (UITouch)touches.First();

            initialTouchPosition = firstTouch.LocationInView(scnView);
            latestTouchPosition  = initialTouchPosition;

            firstTouchedObject = this.VirtualObjectAt(initialTouchPosition);
        }
예제 #6
0
		public override void TouchesMoved (NSSet touches, UIEvent evt)
		{
			var newPoint = ((UITouch)touches.First ()).LocationInView (this);
			// keep all lines drawn by user as touch in record so we can draw them in view
			Lines.Add (new Line (lastPoint, newPoint));

			lastPoint = newPoint;

			// make a draw call
			SetNeedsDisplay ();
		}
예제 #7
0
        public override void TouchesMoved(NSSet touches, UIEvent evt)
        {
            var newPoint = ((UITouch)touches.First()).LocationInView(this);

            // keep all lines drawn by user as touch in record so we can draw them in view
            Lines.Add(new Line(lastPoint, newPoint));

            lastPoint = newPoint;

            // make a draw call
            SetNeedsDisplay();
        }
예제 #8
0
        /// <summary>
        /// Toucheses the ended.
        /// </summary>
        /// <param name="touches">Touches.</param>
        /// <param name="evt">Evt.</param>
        public override void TouchesEnded(NSSet touches, UIEvent evt)
        {
            base.TouchesEnded(touches, evt);

            var touch = touches.First() as UITouch;

            if (touch.View is UIImageView)
            {
                int rawX = (int)touch.LocationInView(View).X;
                int rawY = (int)touch.LocationInView(View).Y;

                var rawXDelta = Math.Abs(rawX - _oldRawX);
                var rawYDelta = Math.Abs(rawY - _oldRawY);

                if (rawXDelta < 15 && rawYDelta < 15)
                {
                    var degrees = GetRotationValueOfView(touch.View);

                    if (_viewModel.IsTurningClockwise)
                    {
                        degrees += 45.0f;
                    }
                    else
                    {
                        degrees -= 45.0f;
                    }

                    var radians = Math.PI / 180 * degrees;
                    touch.View.Transform = CGAffineTransform.MakeRotation((float)radians);

                    _viewModel.RotateKite((int)touch.View.Tag);

                    _viewModel.MoveKite((int)touch.View.Tag, new Position
                    {
                        X = (float)touch.View.Frame.X,
                        Y = (float)touch.View.Frame.Y
                    });
                }

                _drawView.UpdateTeam(_viewModel.Team);
                View.SetNeedsDisplay();
                _drawView.SetNeedsDisplay();
            }
        }
예제 #9
0
        /// <summary>
        /// Sees if the touch is inside a detected rectangle. If so, switches to "Tracking" mode
        /// </summary>
        /// <param name="touches">Touches.</param>
        /// <param name="evt">Evt.</param>
        public override void TouchesBegan(NSSet touches, UIEvent evt)
        {
            base.TouchesBegan(touches, evt);

            var touch           = touches.First() as UITouch;
            var pt              = touch.LocationInView(overlay);
            var normalizedPoint = new CGPoint(pt.X / overlay.Frame.Width, pt.Y / overlay.Frame.Height);

            if (activeViewer == scanner)
            {
                var trackedRectangle = scanner.Containing(normalizedPoint);
                if (trackedRectangle != null)
                {
                    tracker.Track(trackedRectangle);
                    overlay.Message    = "Target acquired";
                    activeViewer       = tracker;
                    resetButton.Hidden = false;
                }
            }
        }
        /// <summary>
        /// Toucheses the moved.
        /// </summary>
        /// <param name="touches">The touches.</param>
        /// <param name="evt">The evt.</param>
        public override void TouchesMoved(NSSet touches, UIEvent evt)
        {
            base.TouchesMoved(touches, evt);

            if (this.touchedView == null)
            {
                return;
            }

            var newLoc = ((UITouch)touches.First()).LocationInView(this);

            var frame = new CGRect(
                new CGPoint(newLoc.X - this.offsetLocation.X, newLoc.Y - this.offsetLocation.Y),
                this.touchedView.Frame.Size);

            if (this.touchedElement != null)
            {
                this.touchedElement.Layout(frame.ToRectangle());
            }
        }
예제 #11
0
        public void TouchesEnded(NSSet touches, UIEvent evt)
        {
            Debug.WriteLine("TouchesEnded: " + touches.Count);
            if (touches.Count == 1 && _currentTouchType == TouchType.OneFingerTouch)
            {
                Debug.WriteLine("TouchesEnded (TouchType.SingleTouch): " + touches.Count);
                if (SingleFingerTouchEvent != null)
                {
                    var touch     = (UITouch)touches.First();
                    var touchData = new SingleFingerTouch(0, touch.LocationInView(_view), GestureState.End);
                    SingleFingerTouchEvent(this, new EventArgs <SingleFingerTouch>(touchData));
                }

                _currentTouchType = TouchType.None;
            }
            if (_currentTouchType == TouchType.TwoFingerTouch)
            {
                if (TwoFingerTouchEvent != null)
                {
                    Debug.WriteLine("TouchesEnded");

                    var firstViewTouchPoint  = _touchDictionary[_touchList[0]];
                    var secondViewTouchPoint = _touchDictionary[_touchList[1]];

                    var touchData = new TwoFingerTouch(0, firstViewTouchPoint, secondViewTouchPoint, GestureState.End);
                    TwoFingerTouchEvent(this, new EventArgs <TwoFingerTouch>(touchData));
                }

                _currentTouchType = TouchType.None;
            }

            foreach (UITouch touch in touches.Cast <UITouch>())
            {
                var handle = touch.Handle;
                _touchDictionary.Remove(handle);
                _touchList.Remove(handle);
            }
            Debug.WriteLine("TouchesEnded: type: " + _currentTouchType);
        }
예제 #12
0
        private void snapTo(NSSet touches)
        {
            if (spiderView == null)
            {
                return;
            }

            var touch = (UITouch)touches.First();

            lock (spiderAnimator)
            {
                if (dragging != null)
                {
                    spiderAnimator.RemoveBehavior(dragging);
                }

                var position = touch.LocationInView(this);
                dragging = new UISnapBehavior(spiderView, position);

                spiderAnimator.RemoveBehavior(gravity);
                spiderAnimator.AddBehavior(dragging);
            }
        }
예제 #13
0
		public override void TouchesBegan (NSSet touches, UIEvent evt)
		{
			lastPoint = ((UITouch)touches.First ()).LocationInView (this);
		}
예제 #14
0
 public override void TouchesBegan(NSSet touches, UIEvent evt)
 {
     lastPoint = ((UITouch)touches.First()).LocationInView(this);
 }
예제 #15
0
 public override void TouchesBegan(NSSet touches, UIEvent evt)
 {
     base.TouchesBegan(touches, evt);
     _oldPt = (touches.First() as UITouch).LocationInView(UIApplication.SharedApplication.KeyWindow);
 }