PhotoViewerTest.Droid.PhotoViewDroidAttacher.GetDisplayRect C# (CSharp) Method

GetDisplayRect() public method

public GetDisplayRect ( ) : Android.Graphics.RectF
return Android.Graphics.RectF
        public RectF GetDisplayRect()
        {
            CheckMatrixBounds();
            return GetDisplayRect(GetDrawMatrix());
        }

Same methods

PhotoViewDroidAttacher::GetDisplayRect ( Matrix matrix ) : Android.Graphics.RectF

Usage Example

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

            if (null != photoViewAttacher.GetOnPhotoTapListener())
            {
                RectF displayRect = photoViewAttacher.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();

                        photoViewAttacher.GetOnPhotoTapListener().OnPhotoTap(imageView, xResult, yResult);
                        return(true);
                    }
                }
            }
            if (null != photoViewAttacher.GetOnViewTapListener())
            {
                photoViewAttacher.GetOnViewTapListener().OnViewTap(imageView, e.GetX(), e.GetY());
            }

            return(false);
        }
All Usage Examples Of PhotoViewerTest.Droid.PhotoViewDroidAttacher::GetDisplayRect