Beispiel #1
0
        void FireEvent(TouchEffect touchEffect, int id, TouchActionType actionType, List <Point> pointerLocation, bool isInContact)
        {
            // Get the method to call for firing events
            Action <Element, TouchActionEventArgs> onTouchAction = touchEffect._pclTouchEffect.OnTouchAction;

            List <Point> points = new List <Point>();

            for (int i = 0; i < pointerLocation.Count; i++)
            {
                double x     = pointerLocation[i].X - twoIntArray[0];
                double y     = pointerLocation[i].Y - twoIntArray[1];
                Point  point = new Point(_fromPixels(x), _fromPixels(y));
                points.Add(point);
            }

            // Call the method
            onTouchAction(touchEffect._formsElement,
                          new TouchActionEventArgs(id, actionType, points, isInContact, points.Count));
        }
Beispiel #2
0
        void CheckForBoundaryHop(int id, List <Point> pointerLocation)
        {
            TouchEffect touchEffectHit = null;

            foreach (Android.Views.View view in viewDictionary.Keys)
            {
                // Get the view rectangle
                try
                {
                    view.GetLocationOnScreen(twoIntArray);
                }
                catch // System.ObjectDisposedException: Cannot access a disposed object.
                {
                    continue;
                }
                Rectangle viewRect = new Rectangle(twoIntArray[0], twoIntArray[1], view.Width, view.Height);

                if (viewRect.Contains(pointerLocation[pointerLocation.Count - 1]))
                {
                    touchEffectHit = viewDictionary[view];
                }
            }

            if (touchEffectHit != idToEffectDictionary[id])
            {
                if (idToEffectDictionary[id] != null)
                {
                    FireEvent(idToEffectDictionary[id], id, TouchActionType.Exited, pointerLocation, true);
                }
                if (touchEffectHit != null)
                {
                    FireEvent(touchEffectHit, id, TouchActionType.Entered, pointerLocation, true);
                }
                idToEffectDictionary[id] = touchEffectHit;
            }
        }