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;
    }

    // Checks if the window is too small horizontally
    if (rect.right - newLeft < mMinCropWidth) {
      newLeft = rect.right - mMinCropWidth;
    }

    // Checks if the window is too large horizontally
    if (rect.right - newLeft > mMaxCropWidth) {
      newLeft = rect.right - mMaxCropWidth;
    }

    if (newLeft - bounds.left < snapMargin) {
      newLeft = bounds.left;
    }

    // check vertical bounds if aspect ratio is in play
    if (aspectRatio > 0) {
      float newHeight = (rect.right - newLeft) / aspectRatio;

      // Checks if the window is too small vertically
      if (newHeight < mMinCropHeight) {
        newLeft = Math.max(bounds.left, rect.right - mMinCropHeight * aspectRatio);
        newHeight = (rect.right - newLeft) / aspectRatio;
      }

      // Checks if the window is too large vertically
      if (newHeight > mMaxCropHeight) {
        newLeft = Math.max(bounds.left, rect.right - mMaxCropHeight * aspectRatio);
        newHeight = (rect.right - newLeft) / aspectRatio;
      }

      // if top AND bottom edge moves by aspect ratio check that it is within full height bounds
      if (topMoves && bottomMoves) {
        newLeft =
            Math.max(newLeft, Math.max(bounds.left, rect.right - bounds.height() * aspectRatio));
      } else {
        // if top edge moves by aspect ratio check that it is within bounds
        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 bottom edge moves by aspect ratio check that it is within bounds
        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.

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