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

GetScale() public method

public GetScale ( ) : float
return float
        public float GetScale()
        {
            return FloatMath.Sqrt((float) Math.Pow(GetValue(mSuppMatrix, Matrix.MscaleX), 2) + (float) Math.Pow(GetValue(mSuppMatrix, Matrix.MskewY), 2));
        }

Usage Example

Ejemplo n.º 1
0
        public bool OnDoubleTap(Android.Views.MotionEvent ev)
        {
            if (photoViewAttacher == null)
            {
                return(false);
            }
            try {
                float scale = photoViewAttacher.GetScale();
                float x     = ev.GetX();
                float y     = ev.GetY();

                if (scale > photoViewAttacher.GetMinimumScale())
                {
                    photoViewAttacher.SetScale(photoViewAttacher.GetMinimumScale(), x, y, true);
                }
                else
                {
                    photoViewAttacher.SetScale(photoViewAttacher.GetMediumScale(), x, y, true);
                }

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

            return(true);
        }
All Usage Examples Of PhotoViewerTest.Droid.PhotoViewDroidAttacher::GetScale