Ejemplo n.º 1
0
        public override void TouchesMoved(MonoTouch.Foundation.NSSet touches, MonoTouch.UIKit.UIEvent e)
        {
            var bounds = Bounds;
            var touch  = (UITouch)e.TouchesForView(this).AnyObject;

            if (firstTouch)
            {
                firstTouch         = false;
                PreviousLocation   = touch.PreviousLocationInView(this);
                PreviousLocation.Y = bounds.Height - PreviousLocation.Y;
            }
            else
            {
                Location           = touch.LocationInView(this);
                Location.Y         = bounds.Height - Location.Y;
                PreviousLocation   = touch.PreviousLocationInView(this);
                PreviousLocation.Y = bounds.Height - PreviousLocation.Y;
            }

            if (_line.Points == null)
            {
                _line.Points = new List <PointF> ();
            }

            _line.Points.Add(new PointF(Location.X, Location.Y));

            RenderLineFromPoint(PreviousLocation, Location);
        }
Ejemplo n.º 2
0
 public override void TouchesEnded(MonoTouch.Foundation.NSSet touches, MonoTouch.UIKit.UIEvent e)
 {
     StartLocation = Location;
     //Publish to aggregator
     _aggregator.Publish(new MovementFinished {
         FinishDateTime = DateTime.Now
     });
 }
 public override void TouchesBegan(MonoTouch.Foundation.NSSet touches, UIEvent evt)
 {
     currentView++;
     currentView %= totalViews;
     //Console.WriteLine("Current View: {0}", currentView);
     MarkDirty();
     //this.NeedsDisplay = true;
     SetNeedsDisplay();
 }
Ejemplo n.º 4
0
        public override void TouchesBegan(MonoTouch.Foundation.NSSet touches, MonoTouch.UIKit.UIEvent e)
        {
            var bounds = Bounds;
            var touch  = (UITouch)e.TouchesForView(this).AnyObject;

            firstTouch = true;
            Location   = touch.LocationInView(this);
            Location.Y = bounds.Height - Location.Y;
        }
Ejemplo n.º 5
0
        public override void TouchesBegan(MonoTouch.Foundation.NSSet touches, MonoTouch.UIKit.UIEvent e)
        {
            Location = this.Frame.Location;

            var touch  = (UITouch)e.TouchesForView(this).AnyObject;
            var bounds = Bounds;

            StartLocation = touch.LocationInView(this);
            this.Frame    = new RectangleF(Location, bounds.Size);
        }
Ejemplo n.º 6
0
        public override void TouchesMoved(MonoTouch.Foundation.NSSet touches, MonoTouch.UIKit.UIEvent e)
        {
            var bounds = Bounds;
            var touch  = (UITouch)e.TouchesForView(this).AnyObject;

            Location.X         += touch.LocationInView(this).X - StartLocation.X;
            Location.Y         += touch.LocationInView(this).Y - StartLocation.Y;
            this.Frame          = new RectangleF(Location, bounds.Size);
            haveBeenTouchedOnce = true;
        }
Ejemplo n.º 7
0
        public override void TouchesBegan(MonoTouch.Foundation.NSSet touches, MonoTouch.UIKit.UIEvent e)
        {
            this.minX = -this.Frame.Width / 2;
            this.maxX = this.Superview.Frame.Width - this.Frame.Width / 2;
            //Console.WriteLine ("Touched the object");
            location = this.Frame.Location;

            var touch  = (UITouch)e.TouchesForView(this).AnyObject;
            var bounds = Bounds;

            startLocation = touch.LocationInView(this);
            this.Frame    = new RectangleF(location, bounds.Size);
        }
Ejemplo n.º 8
0
        public override void TouchesEnded(MonoTouch.Foundation.NSSet touches, MonoTouch.UIKit.UIEvent e)
        {
            var bounds = Bounds;
            var touch  = (UITouch)e.TouchesForView(this).AnyObject;

            if (firstTouch)
            {
                firstTouch         = false;
                PreviousLocation   = touch.PreviousLocationInView(this);
                PreviousLocation.Y = bounds.Height - PreviousLocation.Y;
                RenderLineFromPoint(PreviousLocation, Location);
            }
        }
Ejemplo n.º 9
0
        public override void TouchesBegan(MonoTouch.Foundation.NSSet touches, MonoTouch.UIKit.UIEvent e)
        {
            var bounds = Bounds;
            var touch  = (UITouch)e.TouchesForView(this).AnyObject;

            firstTouch  = true;
            Location    = touch.LocationInView(this);
            Location.Y  = bounds.Height - Location.Y;
            _line       = new Line();
            _line.Color = Color.Selected;

            // Change back as it might have changed on recieved line
            Color.ChangeBrushColor(Color.Selected);
        }
Ejemplo n.º 10
0
 public override void TouchesEnded(MonoTouch.Foundation.NSSet touches, UIEvent evt)
 {
     base.TouchesEnded(touches, evt);
     if (evt.Type == UIEventType.Touches)
     {
         if (this.IsFirstResponder)
         {
             this.ResignFirstResponder();
         }
         else
         {
             this.BecomeFirstResponder();
         }
     }
 }
Ejemplo n.º 11
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)));
        }
Ejemplo n.º 12
0
        public override void TouchesBegan(MonoTouch.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);
                }
            }
        }
Ejemplo n.º 13
0
        public override void TouchesMoved(MonoTouch.Foundation.NSSet touches, UIEvent evt)
        {
            // Create a path under the finger following the grid
            if (touches.Count == 1)
            {
                // Valid movement
                if (mParent.IsCreatingPath)
                {
                    UITouch touch = (UITouch)touches.AnyObject;

                    PointF fingerLocation = touch.LocationInView(this);

                    Cell cell = getCellFromViewCoordinates(fingerLocation);

                    mParent.CreatePath(cell);
                }
            }
            base.TouchesMoved(touches, evt);
        }
Ejemplo n.º 14
0
        public override void TouchesBegan(MonoTouch.Foundation.NSSet touches, UIEvent evt)
        {
            // Disable gestures on preview mode
            if (mParent.ShouldDisplayFilledCells)
            {
                return;
            }

            // Touch began: find the cell under the finger and register it as a path start
            if (touches.Count == 1)
            {
                UITouch touch = (UITouch)touches.AnyObject;

                PointF fingerLocation = touch.LocationInView(this);

                Cell cell = getCellFromViewCoordinates(fingerLocation);

                mParent.StartPathCreation(cell);
            }
            base.TouchesBegan(touches, evt);
        }
Ejemplo n.º 15
0
        public override void TouchesBegan(Foundation.NSSet touches, UIEvent evt)
        {
            //Create a new path and set the options.
            currentPath               = UIBezierPath.Create();
            currentPath.LineWidth     = StrokeWidth;
            currentPath.LineJoinStyle = CGLineJoin.Round;

            currentPoints.Clear();

            UITouch touch = touches.AnyObject as UITouch;

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

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

            resetBounds(touchLocation);

            btnClear.Hidden = false;
        }
Ejemplo n.º 16
0
        public override void TouchesBegan(MonoTouch.Foundation.NSSet touches, UIEvent evt)
        {
            base.TouchesBegan(touches, evt);

            //Check for touches in the movers
            if (evt.TouchesForView(_topLeft) != null)
            {
                _dragView = _topLeft;
            }
            else if (evt.TouchesForView(_bottomRight) != null)
            {
                _dragView = _bottomRight;
            }
            else if (evt.TouchesForView(this) != null)
            {
                _dragView = this;
            }

            if (_dragView != null)
            {
                _location = ((UITouch)evt.TouchesForView(_dragView).AnyObject).LocationInView(_dragView);
            }
        }
Ejemplo n.º 17
0
        //This event occurs when you drag it around
        public override void TouchesMoved(MonoTouch.Foundation.NSSet touches, MonoTouch.UIKit.UIEvent e)
        {
            //Console.WriteLine ("Dragged the object");
            var bounds = Bounds;
            var touch  = (UITouch)e.TouchesForView(this).AnyObject;

            //Always refer to the StartLocation of the object that you've been dragging.
            var changeX = touch.LocationInView(this).X - startLocation.X;
            var newX    = location.X + changeX;

            if (newX >= minX && newX <= maxX)
            {
                location.X = newX;
                if (this.DragTarget != null)
                {
                    this.DragTarget.MoveX(changeX);
                }
            }
            //location.Y += touch.LocationInView (this).Y - startLocation.Y;


            this.Frame = new RectangleF(location, bounds.Size);
        }
Ejemplo n.º 18
0
 public override void TouchesCancelled(MonoTouch.Foundation.NSSet touches, MonoTouch.UIKit.UIEvent e)
 {
 }
Ejemplo n.º 19
0
        public override void TouchesEnded(MonoTouch.Foundation.NSSet touches, UIEvent evt)
        {
            mParent.EndPathCreation(false);

            base.TouchesEnded(touches, evt);
        }
Ejemplo n.º 20
0
 public override void TouchesEnded(MonoTouch.Foundation.NSSet touches, UIEvent evt)
 {
     OnTouchesEnded.Fire(this, EventArgs.Empty);
     base.TouchesEnded(touches, evt);
 }