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 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.º 3
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.º 4
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.º 5
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.º 6
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.º 7
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.º 8
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);
        }