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); }
public void Run() { ImageView imageView = photoViewAttacher.GetImageView(); if (imageView == null) { return; } float t = Interpolate(); float scale = mZoomStart + t * (mZoomEnd - mZoomStart); float deltaScale = scale / photoViewAttacher.GetScale(); photoViewAttacher.mSuppMatrix.PostScale(deltaScale, deltaScale, mFocalX, mFocalY); photoViewAttacher.CheckAndDisplayMatrix(); // We haven't hit our target scale yet, so post ourselves again if (t < 1f) { Compat.PostOnAnimation(imageView, this); } }
public float GetScale() { return(mAttacher.GetScale()); }