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

            var imageView = _attacher.GetImageView();

            if (null != _attacher.GetOnPhotoTapListener())
            {
                var displayRect = _attacher.GetDisplayRect();

                if (null != displayRect)
                {
                    float x = e.GetX(), y = e.GetY();

                    if (displayRect.Contains(x, y))
                    {
                        float xResult = (x - displayRect.Left) / displayRect.Width();
                        float yResult = (y - displayRect.Top) / displayRect.Height();

                        _attacher.GetOnPhotoTapListener().OnPhotoTap(imageView, xResult, yResult);
                        return(true);
                    }
                }
            }

            if (null != _attacher.GetOnViewTapListener())
            {
                _attacher.GetOnViewTapListener().OnViewTap(imageView, e.GetX(), e.GetY());
            }

            return(false);
        }