CropWindowMoveHandler.java 文件源码

java
阅读 42 收藏 0 点赞 0 评论 0

项目:android-titanium-imagecropper 作者:
/**
 * Change the size of the crop window on the required edge (or edges for corner size move) without
 * affecting "secondary" edges.<br>
 * Only the primary edge(s) are fixed to stay within limits.
 */
private void moveSizeWithFreeAspectRatio(
    RectF rect, float x, float y, RectF bounds, int viewWidth, int viewHeight, float snapMargin) {
  switch (mType) {
    case TOP_LEFT:
      adjustTop(rect, y, bounds, snapMargin, 0, false, false);
      adjustLeft(rect, x, bounds, snapMargin, 0, false, false);
      break;
    case TOP_RIGHT:
      adjustTop(rect, y, bounds, snapMargin, 0, false, false);
      adjustRight(rect, x, bounds, viewWidth, snapMargin, 0, false, false);
      break;
    case BOTTOM_LEFT:
      adjustBottom(rect, y, bounds, viewHeight, snapMargin, 0, false, false);
      adjustLeft(rect, x, bounds, snapMargin, 0, false, false);
      break;
    case BOTTOM_RIGHT:
      adjustBottom(rect, y, bounds, viewHeight, snapMargin, 0, false, false);
      adjustRight(rect, x, bounds, viewWidth, snapMargin, 0, false, false);
      break;
    case LEFT:
      adjustLeft(rect, x, bounds, snapMargin, 0, false, false);
      break;
    case TOP:
      adjustTop(rect, y, bounds, snapMargin, 0, false, false);
      break;
    case RIGHT:
      adjustRight(rect, x, bounds, viewWidth, snapMargin, 0, false, false);
      break;
    case BOTTOM:
      adjustBottom(rect, y, bounds, viewHeight, snapMargin, 0, false, false);
      break;
    default:
      break;
  }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号