Example #1
0
        public bool OnDoubleTap(Android.Views.MotionEvent e)
        {
            if (_attacher == null)
            {
                return(false);
            }

            try
            {
                float scale = _attacher.GetScale();
                float x     = e.GetX();
                float y     = e.GetY();

                if (scale < _attacher.GetMediumScale())
                {
                    _attacher.SetScale(_attacher.GetMediumScale(), x, y, true);
                }
                else if (scale >= _attacher.GetMediumScale() && scale < _attacher.GetMaximumScale())
                {
                    _attacher.SetScale(_attacher.GetMaximumScale(), x, y, true);
                }
                else
                {
                    _attacher.SetScale(_attacher.GetMinimumScale(), x, y, true);
                }
            }
            catch (Java.Lang.ArrayIndexOutOfBoundsException ex)
            {
                // Can sometimes happen when getX() and getY() is called
            }

            return(true);
        }