Example #1
0
        void OnAction(BaseGestureRecognizer recognizer, GestureRecognizerState state)
        {
            var tapRecognizer = recognizer as TwinTechs.Gestures.TapGestureRecognizer;
            var view          = recognizer.View;
            var message       = string.Format("POS: {0} \n", recognizer.LocationInView(view).PrettyPrint());

            message         += string.Format("PARENT POS: {0} \n", recognizer.LocationInView(view.ParentView).PrettyPrint());
            message         += string.Format("PARENT.PARENT POS: {0} \n", recognizer.LocationInView(view.ParentView.ParentView).PrettyPrint());
            message         += string.Format("PAGE POS: {0} \n", recognizer.LocationInView(this).PrettyPrint());
            OutputLabel.Text = message;
        }
Example #2
0
        void OnAction(BaseGestureRecognizer recognizer, GestureRecognizerState state)
        {
            var tapRecognizer = recognizer as TwinTechs.Gestures.LongPressGestureRecognizer;
            var view          = recognizer.View;
            var message       = recognizer + "\n";

            message         += "POS: " + recognizer.LocationInView(view);
            message         += "PARENT POS: " + recognizer.LocationInView(view.ParentView);
            message         += "touches: " + recognizer.NumberOfTouches;    // + ", taps required: " + tapRecognizer.NumberOfTapsRequired;
            OutputLabel.Text = message;
        }
        void OnAction(BaseGestureRecognizer recognizer, GestureRecognizerState state)
        {
            var panRecognizer = recognizer as PanGestureRecognizer;
            var view          = recognizer.View;

            if (state == GestureRecognizerState.Began)
            {
                _startBounds = recognizer.View.Bounds;
                Debug.WriteLine("START " + _startBounds);
            }
            if (state == GestureRecognizerState.Changed)
            {
                var message = "PAN " + recognizer + "\n";
                message += "POS: " + recognizer.LocationInView(view.ParentView);
                var translation = panRecognizer.GetTranslationInView(view.ParentView);
//			message += "touches: " + recognizer.NumberOfTouches + ", velocity: " + velocity;
                message += ", translation: " + translation;
                var bounds = new Rectangle(view.X + translation.X, view.Y + translation.Y, view.Width, view.Height);
                message        += ", vb: " + bounds;
                _startBounds.X += translation.X;
                _startBounds.Y += translation.Y;
                Debug.WriteLine("MOVE " + bounds);
                Device.BeginInvokeOnMainThread(() => {
                    Label2.Layout(bounds);
                });
                OutputLabel.Text = message;
            }
        }
Example #4
0
        void Gesture_OnAction(BaseGestureRecognizer recgonizer, GestureRecognizerState state)
        {
            string message     = "";
            var    panGesture  = recgonizer as PanGestureRecognizer;
            Point  translation = panGesture.GetTranslationInView(MainLayout);
            Point  velocity    = panGesture.GetVelocityInView(MainLayout);

            panGesture.SetTranslationInView(new Point(0, 0), MainLayout);

            //			MyLabel.Text = "PAN " + recognizer.LocationInView (view.ParentView);
            //			Debug.WriteLine ("PAN " + panGesture);
            //			Debug.WriteLine ("location " + panGesture.LocationInView (this));

            switch (panGesture.State)
            {
            case GestureRecognizerState.Began:
                message += "BEGAN ";
                message += "POS: " + recgonizer.LocationInView(MainLayout);
                break;

            case GestureRecognizerState.Changed:
                message += "CHANGED ";
                message += ", translation: " + translation;
                message += ", velocity: " + velocity;
                message += "POS: \n" + recgonizer.LocationInView(panGesture.View).PrettyPrint();
                message += "PARENT POS: \n" + recgonizer.LocationInView(MainLayout).PrettyPrint();
                if (recgonizer.View == Box)
                {
                    message      += ", MOVING VIEW";
                    _boxBounds.X += translation.X;
                    _boxBounds.Y += translation.Y;
                    Box.Layout(_boxBounds);
                }
                break;

            case GestureRecognizerState.Cancelled:
            case GestureRecognizerState.Ended:
            case GestureRecognizerState.Failed:
                message += "FINISHED ";
                break;

            case GestureRecognizerState.Possible:
            default:
                break;
            }
            OutputLabel.Text = message;
        }
Example #5
0
        void OnAction(BaseGestureRecognizer recognizer, GestureRecognizerState state)
        {
            var panRecognizer = recognizer as PanGestureRecognizer;
            var view          = recognizer.View;
            var message       = "PAN " + recognizer + "\n";

            message += "ParentPOS: " + recognizer.LocationInView(view.ParentView);
            message += "POS: " + recognizer.LocationInView(view);
            var translation = panRecognizer.GetTranslationInView(view.ParentView);
            var velocity    = panRecognizer.GetVelocityInView(view.ParentView);

            message += ", translation: " + translation;
            var bounds = new Rectangle(view.X + velocity.X, view.Y + velocity.Y, view.Width, view.Height);

            message         += ", vb: " + bounds;
            OutputLabel.Text = message;
        }
        void OnAction(BaseGestureRecognizer recognizer, GestureRecognizerState state)
        {
            var swipeRecognizer = recognizer as SwipeGestureRecognizer;
            var view            = recognizer.View;
            var message         = "SWIPE " + recognizer + "\n";

            message         += "POS: " + recognizer.LocationInView(view.ParentView);
            message         += "touches: " + recognizer.NumberOfTouches + ", direction: " + swipeRecognizer.Direction;
            OutputLabel.Text = message;
        }