private void adjustLeft(RectF rect,float left,RectF bounds,float snapMargin,float aspectRatio,boolean topMoves,boolean bottomMoves){
  float newLeft=left;
  if (newLeft < 0) {
    newLeft/=1.05f;
    mTouchOffset.x-=newLeft / 1.1f;
  }
  if (newLeft < bounds.left) {
    mTouchOffset.x-=(newLeft - bounds.left) / 2f;
  }
  if (newLeft - bounds.left < snapMargin) {
    newLeft=bounds.left;
  }
  if (rect.right - newLeft < mMinCropWidth) {
    newLeft=rect.right - mMinCropWidth;
  }
  if (rect.right - newLeft > mMaxCropWidth) {
    newLeft=rect.right - mMaxCropWidth;
  }
  if (newLeft - bounds.left < snapMargin) {
    newLeft=bounds.left;
  }
  if (aspectRatio > 0) {
    float newHeight=(rect.right - newLeft) / aspectRatio;
    if (newHeight < mMinCropHeight) {
      newLeft=Math.max(bounds.left,rect.right - mMinCropHeight * aspectRatio);
      newHeight=(rect.right - newLeft) / aspectRatio;
    }
    if (newHeight > mMaxCropHeight) {
      newLeft=Math.max(bounds.left,rect.right - mMaxCropHeight * aspectRatio);
      newHeight=(rect.right - newLeft) / aspectRatio;
    }
    if (topMoves && bottomMoves) {
      newLeft=Math.max(newLeft,Math.max(bounds.left,rect.right - bounds.height() * aspectRatio));
    }
 else {
      if (topMoves && rect.bottom - newHeight < bounds.top) {
        newLeft=Math.max(bounds.left,rect.right - (rect.bottom - bounds.top) * aspectRatio);
        newHeight=(rect.right - newLeft) / aspectRatio;
      }
      if (bottomMoves && rect.top + newHeight > bounds.bottom) {
        newLeft=Math.max(newLeft,Math.max(bounds.left,rect.right - (bounds.bottom - rect.top) * aspectRatio));
      }
    }
  }
  rect.left=newLeft;
}

private void adjustLeft ( RectF rect , float left , RectF bounds , float snapMargin , float aspectRatio , boolean topMoves , boolean bottomMoves ) { float newLeft = left ; if ( newLeft < 0 ) { newLeft /= 1.05f ; mTouchOffset . x -= newLeft / 1.1f ; } if ( newLeft < bounds . left ) { mTouchOffset . x -= ( newLeft - bounds . left ) / 2f ; } if ( newLeft - bounds . left < snapMargin ) { newLeft = bounds . left ; } if ( rect . right - newLeft < mMinCropWidth ) { newLeft = rect . right - mMinCropWidth ; } if ( rect . right - newLeft > mMaxCropWidth ) { newLeft = rect . right - mMaxCropWidth ; } if ( newLeft - bounds . left < snapMargin ) { newLeft = bounds . left ; } if ( aspectRatio > 0 ) { float newHeight = ( rect . right - newLeft ) / aspectRatio ; if ( newHeight < mMinCropHeight ) { newLeft = Math . max ( bounds . left , rect . right - mMinCropHeight * aspectRatio ) ; newHeight = ( rect . right - newLeft ) / aspectRatio ; } if ( newHeight > mMaxCropHeight ) { newLeft = Math . max ( bounds . left , rect . right - mMaxCropHeight * aspectRatio ) ; newHeight = ( rect . right - newLeft ) / aspectRatio ; } if ( topMoves && bottomMoves ) { newLeft = Math . max ( newLeft , Math . max ( bounds . left , rect . right - bounds . height ( ) * aspectRatio ) ) ; } else { if ( topMoves && rect . bottom - newHeight < bounds . top ) { newLeft = Math . max ( bounds . left , rect . right - ( rect . bottom - bounds . top ) * aspectRatio ) ; newHeight = ( rect . right - newLeft ) / aspectRatio ; } if ( bottomMoves && rect . top + newHeight > bounds . bottom ) { newLeft = Math . max ( newLeft , Math . max ( bounds . left , rect . right - ( bounds . bottom - rect . top ) * aspectRatio ) ) ; } } } rect . left = newLeft ; }
get the resulting x - position of the left edge of the crop window given the handle ' s position and the image ' s bounding box and snap radius .
