private float calculateScale ( int x , int y ) { final float centerX = getWidth ( ) / 2f ; final float centerY = getHeight ( ) / 2f ; final float maxDistance = ( float ) Math . sqrt ( centerX * centerX + centerY * centerY ) ; final float deltaX = centerX - x ; final float deltaY = centerY - y ; final float distance = ( float ) Math . sqrt ( deltaX * deltaX + deltaY * deltaY ) ; final float scale = 0.5f + ( distance / maxDistance ) * 0.5f ; return scale ; }
calculates the required scale of the ink - view to fill the whole view