GetDisplayRect() публичный Метод

public GetDisplayRect ( ) : Android.Graphics.RectF
Результат Android.Graphics.RectF
Пример #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);
        }
            public void Fling(int viewWidth, int viewHeight, int velocityX,
                              int velocityY)
            {
                RectF rect = photoViewAttacher.GetDisplayRect();

                if (null == rect)
                {
                    return;
                }

                int startX = (int)Math.Round(-rect.Left);
                int minX, maxX, minY, maxY;

                if (viewWidth < rect.Width())
                {
                    minX = 0;
                    maxX = (int)Math.Round(rect.Width() - viewWidth);
                }
                else
                {
                    minX = maxX = startX;
                }

                int startY = (int)Math.Round(-rect.Top);

                if (viewHeight < rect.Height())
                {
                    minY = 0;
                    maxY = (int)Math.Round(rect.Height() - viewHeight);
                }
                else
                {
                    minY = maxY = startY;
                }

                mCurrentX = startX;
                mCurrentY = startY;

                if (photoViewAttacher.DEBUG)
                {
                    LogManager.GetLogger().d(
                        "PhotoViewAttacher",
                        "fling. StartX:" + startX + " StartY:" + startY
                        + " MaxX:" + maxX + " MaxY:" + maxY);
                }

                // If we actually can move, fling the scroller
                if (startX != maxX || startY != maxY)
                {
                    mScroller.Fling(startX, startY, velocityX, velocityY, minX,
                                    maxX, minY, maxY, 0, 0);
                }
            }
Пример #3
0
 public Android.Graphics.RectF GetDisplayRect()
 {
     return(mAttacher.GetDisplayRect());
 }