Esempio n. 1
0
        void CheckForBoundaryHop(UITouch touch)
        {
            long id = touch.Handle.ToInt64();

            // TODO: Might require converting to a List for multiple hits
            ColorPickerTouchRecognizeriOS recognizerHit = null;

            foreach (UIView view in viewDictionary.Keys)
            {
                CGPoint location = touch.LocationInView(view);

                if (new CGRect(new CGPoint(), view.Frame.Size).Contains(location))
                {
                    recognizerHit = viewDictionary[view];
                }
            }
            if (recognizerHit != idToTouchDictionary[id])
            {
                if (idToTouchDictionary[id] != null)
                {
                    FireEvent(idToTouchDictionary[id], id, ColorPickerTouchActionType.Exited, touch, true);
                }
                if (recognizerHit != null)
                {
                    FireEvent(recognizerHit, id, ColorPickerTouchActionType.Entered, touch, true);
                }
                idToTouchDictionary[id] = recognizerHit;
            }
        }
Esempio n. 2
0
        void FireEvent(ColorPickerTouchRecognizeriOS recognizer, long id, ColorPickerTouchActionType actionType, UITouch touch, bool isInContact)
        {
            // Convert touch location to Xamarin.Forms Point value
            CGPoint cgPoint = touch.LocationInView(recognizer.View);
            Point   xfPoint = new Point(cgPoint.X, cgPoint.Y);

            // Get the method to call for firing events
            Action <Element, ColorPickerTouchActionEventArgs> onTouchAction = recognizer.touchEffect.OnTouchAction;

            // Call that method
            onTouchAction(recognizer.element,
                          new ColorPickerTouchActionEventArgs(id, actionType, xfPoint, isInContact));
        }
Esempio n. 3
0
        protected override void OnAttached()
        {
            // Get the iOS UIView corresponding to the Element that the effect is attached to
            view = Control == null ? Container : Control;

            // Get access to the TouchEffect class in the .NET Standard library
            ColorPickerTouchEffect effect = (ColorPickerTouchEffect)Element.Effects.FirstOrDefault(e => e is ColorPickerTouchEffect);

            if (effect != null && view != null)
            {
                // Create a TouchRecognizer for this UIView
                touchRecognizer = new ColorPickerTouchRecognizeriOS(Element, view, effect);
                view.AddGestureRecognizer(touchRecognizer);
            }
        }