Merge pull request #948 from SteffenUlrich/master

correct aproach for delta error
This commit is contained in:
Oscar Franco 2018-01-12 20:34:17 +01:00 committed by GitHub
commit c7c3caa49a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -140,8 +140,8 @@ public class RCTCamera {
continue;
}
int currentDelta = Math.abs(closestSize.width - matchWidth) * Math.abs(closestSize.height - matchHeight);
int newDelta = Math.abs(size.width - matchWidth) * Math.abs(size.height - matchHeight);
double currentDelta = Math.sqrt(Math.pow(closestSize.width - matchWidth,2) + Math.pow(closestSize.height - matchHeight,2));
double newDelta = Math.sqrt(Math.pow(size.width - matchWidth,2) + Math.pow(size.height - matchHeight,2));
if (newDelta < currentDelta) {
closestSize = size;