I have implemented pinch to zoom in my app.Normal zoom in and zoom out are working fine. But if i zoom out while zooming in(without taking hands off from canvas) it is returning scale factor greater than 1 only. So i am not able to do he calculation properly.Is there any way to find out the zoom direction other than checking scalefactor value greater than 1.0 or not?
2 Answers
0
votes
This works for me
private class ScaleListener extends ScaleGestureDetector.SimpleOnScaleGestureListener
{
@Override
public boolean onScale(ScaleGestureDetector detector)
{
mScaleFactor *= detector.getScaleFactor();
// Don't let the object get too small or too large.
mScaleFactor = Math.max(MIN_SCALE, Math.min(mScaleFactor, MAX_SCALE));
//Log.d(TAG, "factor = " + mScaleFactor);
updateTextSize();
return true;
}
}