Esempio n. 1
0
        protected override void OnAttached()
        {
            view = Control == null ? Container : Control;


            ScreenTouch effect = (ScreenTouch)Element.Effects.FirstOrDefault(e => e is ScreenTouch);

            if (effect != null && view != null)
            {
                recognizer = new TouchRecognizer(Element, view, effect);
                view.AddGestureRecognizer(recognizer);
            }
        }
Esempio n. 2
0
        void FireEvent(TouchRecognizer recognizer, long id, TouchActionEventArgs.TouchActionType actionType, UITouch touch, bool isInContact, List <int> contactIndexes, List <Xamarin.Forms.View> contactView)
        {
            Console.WriteLine("contact " + isInContact);
            // Get the method to call for firing events
            Action <Element, TouchActionEventArgs> onTouchAction = recognizer.touchEffect.OnTouchAction;

            // Get the location within the view
            var   cgPoint = touch.LocationInView(view);
            Point point   = new Point(cgPoint.X - view.Bounds.Width / 2, cgPoint.Y - view.Bounds.Height / 2);

            // Call the method
            onTouchAction(touchEffect.Element,
                          new TouchActionEventArgs(actionType, point, isInContact, contactIndexes, contactView));
            isInContact = false;
        }