improve preview size lookup

pull/40/head
jsjem 7 years ago committed by GitHub
parent d502a7ae77
commit dc3fd9c509
  1. 10
      camerafragment/src/main/java/com/github/florent37/camerafragment/internal/utils/CameraHelper.java

@ -251,7 +251,10 @@ public final class CameraHelper {
double ratio = (double) size.getHeight() / size.getWidth();
if (Math.abs(ratio - targetRatio) < MIN_TOLERANCE) MIN_TOLERANCE = Math.abs(ratio - targetRatio);
if (Math.abs(ratio - targetRatio) < MIN_TOLERANCE) {
MIN_TOLERANCE = Math.abs(ratio - targetRatio);
minDiff = Double.MAX_VALUE;
}
else continue;
if (Math.abs(size.getHeight() - targetHeight) < minDiff) {
@ -325,7 +328,10 @@ public final class CameraHelper {
double ratio = (double) size.getHeight() / size.getWidth();
if (Math.abs(ratio - targetRatio) < MIN_TOLERANCE) MIN_TOLERANCE = Math.abs(ratio - targetRatio);
if (Math.abs(ratio - targetRatio) < MIN_TOLERANCE) {
MIN_TOLERANCE = Math.abs(ratio - targetRatio);
minDiff = Double.MAX_VALUE;
}
else continue;
if (Math.abs(size.getHeight() - targetHeight) < minDiff) {

Loading…
Cancel
Save