Code example for ScaleGestureDetector

Methods: getCurrentSpan, getFocusX, getFocusY, getPreviousSpan, getScaleFactor

0
	public class ScaleListener extends ScaleGestureDetector.SimpleOnScaleGestureListener {
 
		@SuppressWarnings("unused") 
		@Override 
		public boolean onScale( ScaleGestureDetector detector ) {
			float span = detector.getCurrentSpan() - detector.getPreviousSpan();
			float targetScale = mCurrentScaleFactor * detector.getScaleFactor();
			if ( mScaleEnabled ) {
//				targetScale = Math.min( getMaxZoom(), Math.max( targetScale, MIN_ZOOM ) ); 
				zoomTo( targetScale, detector.getFocusX(), detector.getFocusY() );
//				mCurrentScaleFactor = Math.min( getMaxZoom(), Math.max( targetScale, MIN_ZOOM ) ); 
				mCurrentScaleFactor = targetScale;
				if(targetScale >= getMaxZoom())
					mDoubleTapDirection = -1;
				else 
					mDoubleTapDirection = 1;
				 
				invalidate(); 
				return true; 
			} 
			return false;