private void adjustBottom(
      RectF rect,
      float bottom,
      RectF bounds,
      int viewHeight,
      float snapMargin,
      float aspectRatio,
      boolean leftMoves,
      boolean rightMoves) {

    float newBottom = bottom;

    if (newBottom > viewHeight) {
      newBottom = viewHeight + (newBottom - viewHeight) / 1.05f;
      mTouchOffset.y -= (newBottom - viewHeight) / 1.1f;
    }

    if (newBottom > bounds.bottom) {
      mTouchOffset.y -= (newBottom - bounds.bottom) / 2f;
    }

    if (bounds.bottom - newBottom < snapMargin) {
      newBottom = bounds.bottom;
    }

    // Checks if the window is too small vertically
    if (newBottom - rect.top < mMinCropHeight) {
      newBottom = rect.top + mMinCropHeight;
    }

    // Checks if the window is too small vertically
    if (newBottom - rect.top > mMaxCropHeight) {
      newBottom = rect.top + mMaxCropHeight;
    }

    if (bounds.bottom - newBottom < snapMargin) {
      newBottom = bounds.bottom;
    }

    // check horizontal bounds if aspect ratio is in play
    if (aspectRatio > 0) {
      float newWidth = (newBottom - rect.top) * aspectRatio;

      // Checks if the window is too small horizontally
      if (newWidth < mMinCropWidth) {
        newBottom = Math.min(bounds.bottom, rect.top + mMinCropWidth / aspectRatio);
        newWidth = (newBottom - rect.top) * aspectRatio;
      }

      // Checks if the window is too large horizontally
      if (newWidth > mMaxCropWidth) {
        newBottom = Math.min(bounds.bottom, rect.top + mMaxCropWidth / aspectRatio);
        newWidth = (newBottom - rect.top) * aspectRatio;
      }

      // if left AND right edge moves by aspect ratio check that it is within full width bounds
      if (leftMoves && rightMoves) {
        newBottom =
            Math.min(newBottom, Math.min(bounds.bottom, rect.top + bounds.width() / aspectRatio));
      } else {
        // if left edge moves by aspect ratio check that it is within bounds
        if (leftMoves && rect.right - newWidth < bounds.left) {
          newBottom = Math.min(bounds.bottom, rect.top + (rect.right - bounds.left) / aspectRatio);
          newWidth = (newBottom - rect.top) * aspectRatio;
        }

        // if right edge moves by aspect ratio check that it is within bounds
        if (rightMoves && rect.left + newWidth > bounds.right) {
          newBottom =
              Math.min(
                  newBottom,
                  Math.min(bounds.bottom, rect.top + (bounds.right - rect.left) / aspectRatio));
        }
      }
    }

    rect.bottom = newBottom;
  }
Get the resulting y-position of the bottom edge of the crop window given the handle's position
and the image's bounding box and snap radius.

@param bottom the position that the bottom edge is dragged to
@param bounds the bounding box of the image that is being cropped
@param viewHeight
@param snapMargin the snap distance to the image edge (in pixels)
core/src/main/java/com/theartofdev/edmodo/cropper/CropWindowMoveHandler.java