Android-Image-Cropper icon indicating copy to clipboard operation
Android-Image-Cropper copied to clipboard

Add option: autozoom treshold

Open Janneman84 opened this issue 3 years ago • 2 comments

Currently the autozoom doesn't kick in until the crop window gets below 50% screen size. I'd like it to be a bit more aggressive.

In the code these seem to be hard coded values, i.e. triggers at 0.5, then zooms to 0.65. It'd be nice if these values can be changed as options. It should assert that the zoom to value is always higher than the treshold of course.

This is the code where the values are currently hard coded:

  // keep the cropping window covered area to 50%-65% of zoomed sub-area
  if (mZoom < mMaxZoom && cropRect.width() < width * 0.5f && cropRect.height() < height * 0.5f) {
      newZoom = min(
          mMaxZoom.toFloat(),
          min(
              width / (cropRect.width() / mZoom / 0.64f),
              height / (cropRect.height() / mZoom / 0.64f)
          )
      )
  }
  if (mZoom > 1 && (cropRect.width() > width * 0.65f || cropRect.height() > height * 0.65f)) {
      newZoom = max(
          1f,
          min(
              width / (cropRect.width() / mZoom / 0.51f),
              height / (cropRect.height() / mZoom / 0.51f)
          )
      )
  }

I've been seeing a lot more options being added lately, can this be one of them?

Janneman84 avatar Aug 22 '22 10:08 Janneman84

Yes! is a great option. Let's add

Canato avatar Aug 27 '22 07:08 Canato

Let's keep this mess organised! This issue has been automatically marked as stale because it has not had recent activity. =( It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Sep 16 '22 00:09 stale[bot]