private void adjustLeftRightByAspectRatio(RectF rect, RectF bounds, float aspectRatio) {
    rect.inset((rect.width() - rect.height() * aspectRatio) / 2, 0);
    if (rect.left < bounds.left) {
      rect.offset(bounds.left - rect.left, 0);
    }
    if (rect.right > bounds.right) {
      rect.offset(bounds.right - rect.right, 0);
    }
  }
Adjust left and right edges by current crop window height and the given aspect ratio, both
right and left edges adjusts equally relative to center to keep aspect ratio to the height.
core/src/main/java/com/theartofdev/edmodo/cropper/CropWindowMoveHandler.java