Beispiel #1
0
        //
        public override void TouchesBegan(Foundation.NSSet touches, UIEvent evt)
        {
            base.TouchesBegan(touches, evt);
            UITouch touch1 = evt.AllTouches.AnyObject as UITouch;
            CGPoint point  = touch1.LocationInView(View);

            if (point.X > lbl1.Frame.X && point.X < lbl1.Frame.X + lbl1.Frame.Size.Width && point.Y > lbl1.Frame.Y && point.Y < lbl1.Frame.Y + lbl1.Frame.Size.Height)
            {
                myLab = lbl1;
            }
            if (point.X > lbl2.Frame.X && point.X < lbl2.Frame.X + lbl2.Frame.Size.Width && point.Y > lbl2.Frame.Y && point.Y < lbl2.Frame.Y + lbl2.Frame.Size.Height)
            {
                myLab = lbl2;
            }
            if (point.X > lbl3.Frame.X && point.X < lbl3.Frame.X + lbl3.Frame.Size.Width && point.Y > lbl3.Frame.Y && point.Y < lbl3.Frame.Y + lbl3.Frame.Size.Height)
            {
                myLab = lbl3;
            }
            if (point.X > lbl4.Frame.X && point.X < lbl4.Frame.X + lbl4.Frame.Size.Width && point.Y > lbl4.Frame.Y && point.Y < lbl4.Frame.Y + lbl4.Frame.Size.Height)
            {
                myLab = lbl4;
            }
            if (point.X > lbl5.Frame.X && point.X < lbl5.Frame.X + lbl5.Frame.Size.Width && point.Y > lbl5.Frame.Y && point.Y < lbl5.Frame.Y + lbl5.Frame.Size.Height)
            {
                myLab = lbl5;
            }
        }
Beispiel #2
0
        public override void TouchesEnded(Foundation.NSSet touches, UIEvent evt)
        {
            if (_pointer2 != null && touches.Contains(_pointer2))
            {
                CGPoint screenPos1 = _pointer1.LocationInView(this);
                CGPoint screenPos2 = _pointer2.LocationInView(this);
                _baseMapView.OnInputEvent(NativeActionPointer2Up, (float)screenPos1.X * _scale, (float)screenPos1.Y * _scale, (float)screenPos2.X * _scale, (float)screenPos2.Y * _scale);
                _pointer2 = null;
            }

            if (_pointer1 != null && touches.Contains(_pointer1))
            {
                CGPoint screenPos1 = _pointer1.LocationInView(this);
                if (_pointer2 != null)
                {
                    CGPoint screenPos2 = _pointer2.LocationInView(this);
                    _baseMapView.OnInputEvent(NativeActionPointer1Up, (float)screenPos1.X * _scale, (float)screenPos1.Y * _scale, (float)screenPos2.X * _scale, (float)screenPos2.Y * _scale);
                    _pointer1 = _pointer2;
                    _pointer2 = null;
                }
                else
                {
                    _baseMapView.OnInputEvent(NativeActionPointer1Up, (float)screenPos1.X * _scale, (float)screenPos1.Y * _scale, NativeNoCoordinate, NativeNoCoordinate);
                    _pointer1 = null;
                }
            }
        }
        public override void TouchesBegan(Foundation.NSSet touches, UIEvent evt)
        {
            base.TouchesBegan(touches, evt);
            UITouch touch = touches.AnyObject as UITouch;

            Animation.pulseExpandAnimation(layer: Layer, visualLayer: VisualLayer, point: Layer.ConvertPointToLayer(point: touch.LocationInView(this), layer: Layer), width: this.Width(), height: this.Height(), pulse: Pulse);
        }
        public override void TouchesEnded(Foundation.NSSet touches, UIEvent evt)
        {
            base.TouchesEnded(touches, evt);
            var touch = touches.AnyObject as UITouch;

            if (touch == null || nodeIsMoving == false || currentMovingNode == null)
            {
                return;
            }

            if (DropableCanvas.Frame.Contains(currentMovingNode.Center) == true)
            {
                //Remove this view from superview
                currentMovingNode.RemoveFromSuperview();

                binarySearchTreeView.InsertNode(int.Parse(currentMovingNode.Text));
            }
            else
            {
                currentMovingNode.Frame = currentMovingNodeOriginalPosition;
            }

            currentMovingNode = null;
            currentMovingNodeOriginalPosition = CGRect.Empty;
            nodeIsMoving = false;
        }
Beispiel #5
0
        public override void TouchesBegan(Foundation.NSSet touches, UIEvent evt)
        {
            var touch = touches.AnyObject as UITouch;

            if (Magnifier == null)
            {
                Magnifier = new Magnifier();
            }

            if (Magnifier.ViewToMagnify == null)
            {
                Magnifier.ViewToMagnify = this;
            }

            var touchPoint = touch.LocationInView(this);

            Magnifier.TouchPoint = touchPoint;
            this.Superview.AddSubview(Magnifier);

            if (ShowOnTouch)
            {
                ShouldDisplay = true;
            }

            Magnifier.SetNeedsDisplay();
        }
Beispiel #6
0
        public override void TouchesCancelled(Foundation.NSSet touches, UIEvent evt)
        {
            // Note: should use ACTION_CANCEL here, but Xamarin.Forms uses this
            // for single clicks, so we need to emulate TouchesEnded here actually
            if (_pointer2 != null && touches.Contains(_pointer2))
            {
                if (_pointer1 != null && !touches.Contains(_pointer1))
                {
                    CGPoint screenPos1 = _pointer1.LocationInView(this);
                    _baseMapView.OnInputEvent(NativeActionPointer2Up, (float)screenPos1.X * _scale, (float)screenPos1.Y * _scale, NativeNoCoordinate, NativeNoCoordinate);
                }
                else
                {
                    _baseMapView.OnInputEvent(NativeActionPointer2Up, NativeNoCoordinate, NativeNoCoordinate, NativeNoCoordinate, NativeNoCoordinate);
                }
                _pointer2 = null;
            }

            if (_pointer1 != null && touches.Contains(_pointer1))
            {
                if (_pointer2 != null)
                {
                    CGPoint screenPos2 = _pointer2.LocationInView(this);
                    _baseMapView.OnInputEvent(NativeActionPointer1Up, NativeNoCoordinate, NativeNoCoordinate, (float)screenPos2.X * _scale, (float)screenPos2.Y * _scale);
                    _pointer1 = _pointer2;
                    _pointer2 = null;
                }
                else
                {
                    _baseMapView.OnInputEvent(NativeActionPointer1Up, NativeNoCoordinate, NativeNoCoordinate, NativeNoCoordinate, NativeNoCoordinate);
                    _pointer1 = null;
                }
            }
        }
Beispiel #7
0
        public override void TouchesMoved(Foundation.NSSet touches, UIEvent evt)
        {
            base.TouchesMoved(touches, evt);
            UITouch touch1 = evt.AllTouches.AnyObject as UITouch;
            CGPoint point  = touch1.LocationInView(View);

            if (myLab == lbl1)
            {
                myPos       = point;
                lbl1.Center = myPos;
            }
            if (myLab == lbl2)
            {
                myPos       = point;
                lbl2.Center = myPos;
            }
            if (myLab == lbl3)
            {
                myPos       = point;
                lbl3.Center = myPos;
            }
            if (myLab == lbl4)
            {
                myPos       = point;
                lbl4.Center = myPos;
            }
            if (myLab == lbl5)
            {
                myPos       = point;
                lbl5.Center = myPos;
            }
        }
        public override void TouchesBegan(Foundation.NSSet touches, UIEvent evt)
        {
            base.TouchesBegan(touches, evt);

            var touch = touches.AnyObject as UITouch;

            Debug.WriteLine($"TapCount:{touch.TapCount}");
        }
Beispiel #9
0
 public override void TouchesCancelled(Foundation.NSSet touches, UIKit.UIEvent evt)
 {
     base.TouchesCancelled(touches, evt);
     if (ImageTouch != null)
     {
         ImageTouch.RaiseOnTouch(false);
     }
 }
Beispiel #10
0
 public override void TouchesEnded(Foundation.NSSet touches, UIEvent evt)
 {
     base.TouchesEnded(touches, evt);
     if (this.Touched != null)
     {
         this.Touched(this, null);
     }
 }
Beispiel #11
0
 public override void TouchesBegan(Foundation.NSSet touches, UIKit.UIEvent evt)
 {
     base.TouchesBegan(touches, evt);
     if (ImageTouch != null)
     {
         ImageTouch.RaiseOnTouch(true);
     }
 }
Beispiel #12
0
 public override void TouchesEnded(Foundation.NSSet touches, UIEvent evt)
 {
     base.TouchesEnded(touches, evt);
     if (this.Layer != null)
     {
         //this.Layer.RemoveFromSuperLayer();
         //this.SetAni(200, 0);
     }
 }
Beispiel #13
0
        public override void TouchesMoved(Foundation.NSSet touches, UIEvent evt)
        {
            base.TouchesMoved(touches, evt);
            UITouch touch = touches.AnyObject as UITouch;

            this.touchLocation     = touch.LocationInView(this);
            this.prevTouchLocation = touch.PreviousLocationInView(this);
            this.SetNeedsDisplay();
        }
Beispiel #14
0
 public override void TouchesBegan(Foundation.NSSet touches, UIEvent evt)
 {
     currentView++;
     currentView %= paintViewActions.Length;
     //Console.WriteLine("Current View: {0}", currentView);
     MarkDirty();
     //this.NeedsDisplay = true;
     SetNeedsDisplay();
 }
Beispiel #15
0
        public override void TouchesEnded(Foundation.NSSet touches, UIEvent evt)
        {
            base.TouchesEnded(touches, evt);

            if (!IsRunningAnimation && Radius > 0)
            {
                OnTargetClicked?.Invoke();
            }
        }
        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);
            }
        }
 public override void TouchesBegan(Foundation.NSSet touches, UIEvent evt)
 {
     if (evt.TouchesForGestureRecognizer(this).Count == 1)
     {
         State = UIGestureRecognizerState.Began;
     }
     else
     {
         State = UIGestureRecognizerState.Failed;
     }
 }
        public override void TouchesMoved(Foundation.NSSet touches, UIEvent evt)
        {
            base.TouchesMoved(touches, evt);

            var touch = touches.AnyObject as UITouch;

            //var pointOfButton = touch.PreviousLocationInView (this.btnLogin);
            var pointOfView = touch.LocationInView(this.View);

            Debug.WriteLine($"X:{pointOfView.X}, Y:{pointOfView.Y}");
        }
Beispiel #19
0
        public override void TouchesMoved(Foundation.NSSet touches, UIEvent evt)
        {
            UITouch touch = touches.AnyObject as UITouch;

            //Obtain the location of the touch and add it to the current path and current_points array.
            CGPoint touchLocation = touch.LocationInView(this);

            currentPath.AddLineTo(touchLocation);
            currentPoints.Add(touchLocation);

            updateBounds(touchLocation);
            SetNeedsDisplayInRect(new CGRect(minX, minY, (nfloat)Math.Abs(maxX - minX), (nfloat)Math.Abs(maxY - minY)));
        }
Beispiel #20
0
        public override void TouchesBegan(Foundation.NSSet touches, UIEvent evt)
        {
            base.TouchesBegan(touches, evt);

            if (!IsEnabled)
            {
                return;
            }

            try
            {
                UITouch touch   = touches.ToArray <UITouch>()[0];
                CGPoint cgPoint = touch.LocationInView(this);

                NGraphics.Point pointReal = new NGraphics.Point(cgPoint.X, cgPoint.Y);
                NGraphics.Point point;
                if (IsTitleOnTop)
                {
                    point = new NGraphics.Point(pointReal.X, pointReal.Y + textHeight);
                }
                else
                {
                    point = new NGraphics.Point(pointReal.X, pointReal.Y - textHeight);
                }

                if (Center.HasValue && RadiusAll.HasValue)
                {
                    double selectedRadian = RadianOfPoint(point);

                    double sumRadian = 0.0;
                    foreach (var eachSegment in ListItems)
                    {
                        if (sumRadian <= selectedRadian && selectedRadian <= sumRadian + eachSegment.Radian)
                        {
                            eachSegment.IsSelected = true;
                            SelectedItem           = eachSegment;
                            ItemSelected?.Invoke(this, eachSegment);
                        }
                        sumRadian += eachSegment.Radian;
                    }
                }
            }
            // Analysis disable once EmptyGeneralCatchClause
            catch (Exception exc)
            {
                                #if DEBUG
                throw;
                                #endif
            }
        }
Beispiel #21
0
 public override void TouchesMoved(Foundation.NSSet touches, UIEvent evt)
 {
     if (_pointer1 != null)
     {
         CGPoint screenPos1 = _pointer1.LocationInView(this);
         if (_pointer2 != null)
         {
             CGPoint screenPos2 = _pointer2.LocationInView(this);
             _baseMapView.OnInputEvent(NativeActionMove, (float)screenPos1.X * _scale, (float)screenPos1.Y * _scale, (float)screenPos2.X * _scale, (float)screenPos2.Y * _scale);
         }
         else
         {
             _baseMapView.OnInputEvent(NativeActionMove, (float)screenPos1.X * _scale, (float)screenPos1.Y * _scale, NativeNoCoordinate, NativeNoCoordinate);
         }
     }
 }
Beispiel #22
0
        public override void TouchesBegan(Foundation.NSSet touches, UIEvent evt)
        {
            base.TouchesBegan(touches, evt);

            UITouch t   = touches.AnyObject as UITouch;
            CGPoint tap = t.LocationInView(this);

            CurrentPrime.RemoveFromSuperview();

            //if tap is outside setting window thingy, remove from view
            if (Loader.SETTINGS_OPEN)
            {
                //ViewController.LoaderInstance.RenderView(Loader.CurrentState);
                Loader.SettingsView.RemoveFromSuperview();
            }
        }
        public override void TouchesMoved(Foundation.NSSet touches, UIEvent evt)
        {
            base.TouchesMoved(touches, evt);

            // Loop all touch positions
            foreach (var touch in touches)
            {
                // Get the current and last points
                var points = new NSMutableDictionary();

                points.Add(new NSString("currentPoint"), NSValue.FromCGPoint(((UITouch)touch).LocationInView(this)));
                points.Add(new NSString("lastPoint"), NSValue.FromCGPoint(((UITouch)touch).PreviousLocationInView(this)));

                // Draw
                PerformSelector(new Selector("DrawLine:"), points, 0.0f);
            }
        }
        public override void TouchesMoved(Foundation.NSSet touches, UIEvent evt)
        {
            base.TouchesMoved(touches, evt);
            var touch = touches.AnyObject as UITouch;

            if (touch == null || nodeIsMoving == false || currentMovingNode == null)
            {
                return;
            }

            nfloat deltaX = touch.PreviousLocationInView(NodesContainerView).X - touch.LocationInView(NodesContainerView).X;
            nfloat deltaY = touch.PreviousLocationInView(NodesContainerView).Y - touch.LocationInView(NodesContainerView).Y;

            var newPoint = new CGPoint(currentMovingNode.Frame.X - deltaX, currentMovingNode.Frame.Y - deltaY);

            currentMovingNode.Frame = new CGRect(newPoint, currentMovingNode.Frame.Size);
        }
Beispiel #25
0
        public override void TouchesBegan(Foundation.NSSet touches, UIEvent evt)
        {
            base.TouchesBegan(touches, evt);

            UITouch touch = touches.AnyObject as UITouch;

            if (touch.TapCount == 2)
            {
                if (ZoomScale >= 2)
                {
                    SetZoomScale(1, true);
                }
                else
                {
                    SetZoomScale(3, true);
                }
            }
        }
Beispiel #26
0
            public override void TouchesBegan(Foundation.NSSet touches, UIEvent evt)
            {
                base.TouchesBegan(touches, evt);

                if (this.Layer == null)
                {
                    this.Layer       = new RadialGradientLayer();
                    this.Layer.Frame = new CGRect(0, 0, this.View.Frame.Width, this.View.Frame.Height);
                    this.View.Layer.AddSublayer(this.Layer);
                }

                var t     = (UITouch)touches.AnyObject;
                var point = t.LocationInView(this.View);

                this.Layer.Center = point;

                this.SetAni(0, 50);
            }
        public override void TouchesEnded(Foundation.NSSet touches, UIEvent evt)
        {
            base.TouchesEnded(touches, evt);

            var touch = touches.FirstOrDefault() as UITouch;

            if (touch != null)
            {
                var location = touch.LocationInView(this);
                if (location.X > Frame.Width || location.X < 0 || location.Y > Frame.Height || location.Y < 0)
                {
                    return;
                }

                UIApplication.SharedApplication.OpenUrl(NSUrl.FromString($"http://appropio.com?utm_source={NSBundle.MainBundle.InfoDictionary["CFBundleIdentifier"]?.ToString()}"), new UIApplicationOpenUrlOptions(), (obj) => { });
            }

            Animate(0.2f, () => Alpha = 1);
        }
        public override void TouchesBegan(Foundation.NSSet touches, UIEvent evt)
        {
            base.TouchesBegan(touches, evt);
            var touch = touches.AnyObject as UITouch;

            if (touch == null)
            {
                return;
            }

            var locationinContainerView = touch.LocationInView(NodesContainerView);

            //check which subview falls under this
            currentMovingNode = NodesContainerView.Subviews.FirstOrDefault(node => node.Frame.Contains(locationinContainerView)) as CircleView;
            if (currentMovingNode != null)
            {
                nodeIsMoving = true;
                currentMovingNodeOriginalPosition = currentMovingNode.Frame;
            }
        }
        public override void TouchesMoved(Foundation.NSSet touches, UIEvent evt)
        {
            State = UIGestureRecognizerState.Changed;
            var touch  = (UITouch)touches.AnyObject;
            var view   = View;
            var center = new CGPoint(view.Bounds.GetMidX(), view.Bounds.GetMinY());

            var currentTouchPoint  = touch.LocationInView(view);
            var previousTouchPoint = touch.PreviousLocationInView(view);

            var angleInRadians = Math.Atan2(currentTouchPoint.Y - center.Y, currentTouchPoint.X - center.X)
                                 - Math.Atan2(previousTouchPoint.Y - center.Y, previousTouchPoint.X - center.X);

            if (angleInRadians > Math.PI)
            {
                angleInRadians -= Math.PI;
            }

            Rotation = angleInRadians;
        }
Beispiel #30
0
        public override void TouchesBegan(Foundation.NSSet touches, UIEvent evt)
        {
            foreach (UITouch pointer in touches)
            {
                if (_pointer1 == null)
                {
                    _pointer1 = pointer;
                    CGPoint screenPos1 = _pointer1.LocationInView(this);
                    _baseMapView.OnInputEvent(NativeActionPointer1Down, (float)screenPos1.X * _scale, (float)screenPos1.Y * _scale, NativeNoCoordinate, NativeNoCoordinate);
                    continue;
                }

                if (_pointer2 == null)
                {
                    _pointer2 = pointer;
                    CGPoint screenPos1 = _pointer1.LocationInView(this);
                    CGPoint screenPos2 = _pointer2.LocationInView(this);
                    _baseMapView.OnInputEvent(NativeActionPointer2Down, (float)screenPos1.X * _scale, (float)screenPos1.Y * _scale, (float)screenPos2.X * _scale, (float)screenPos2.Y * _scale);
                    break;
                }
            }
        }