From 7c83219fe96d54703cd645e1233d2b1f58dd51ca Mon Sep 17 00:00:00 2001 From: WilliamVerhaeghe Date: Mon, 11 Sep 2023 11:33:39 +0200 Subject: [PATCH] Fixed issue with fitcropspace --- lib/src/calculators/calculate_crop_fit_params.dart | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/src/calculators/calculate_crop_fit_params.dart b/lib/src/calculators/calculate_crop_fit_params.dart index a245b05..195ec8b 100644 --- a/lib/src/calculators/calculate_crop_fit_params.dart +++ b/lib/src/calculators/calculate_crop_fit_params.dart @@ -1,5 +1,3 @@ -import 'dart:math'; - import 'package:custom_image_crop/src/models/params_model.dart'; import 'package:custom_image_crop/src/widgets/custom_image_crop_widget.dart'; @@ -39,13 +37,11 @@ CropFitParams calculateCropFitParams({ if (screenWidth <= screenHeight * aspectRatio) { cropSizeWidth = screenWidth * cropPercentage; cropSizeHeight = cropSizeWidth / aspectRatio; - defaultScale = - cropSizeWidth / max(imageWidth, imageHeight * aspectRatio); + defaultScale = cropSizeHeight / imageHeight; } else { cropSizeHeight = screenHeight * cropPercentage; cropSizeWidth = cropSizeHeight * aspectRatio; - defaultScale = - cropSizeHeight / max(imageHeight, imageWidth / aspectRatio); + defaultScale = cropSizeWidth / imageWidth; } break;