diff --git a/lib/src/editor/editor.dart b/lib/src/editor/editor.dart index 6c6b63cf..b8203caf 100644 --- a/lib/src/editor/editor.dart +++ b/lib/src/editor/editor.dart @@ -64,12 +64,19 @@ class ExtendedImageEditorState extends State { widget.extendedImageState.extendedImageInfo!.image.height; } _editActionDetails!.cropAspectRatio = _editorConfig!.cropAspectRatio; + _editActionDetails!.initialCropAspectRatio = + _editorConfig!.initialCropAspectRatio; if (_editorConfig!.cropAspectRatio != null && _editorConfig!.cropAspectRatio! <= 0) { _editActionDetails!.cropAspectRatio = _editActionDetails!.originalAspectRatio; } + if (_editorConfig!.initialCropAspectRatio != null && + _editorConfig!.initialCropAspectRatio! <= 0) { + _editActionDetails!.initialCropAspectRatio = + _editActionDetails!.originalAspectRatio; + } } @override @@ -197,10 +204,10 @@ class ExtendedImageEditorState extends State { _editActionDetails!.cropAspectRatio!, ); } - if (_editorConfig!.initialCropAspectRatio != null) { + if (_editActionDetails!.initialCropAspectRatio != null) { return _calculateCropRectFromAspectRatio( rect, - _editorConfig!.initialCropAspectRatio!, + _editActionDetails!.initialCropAspectRatio!, ); } return _editActionDetails!.getRectWithScale(rect); diff --git a/lib/src/editor/editor_utils.dart b/lib/src/editor/editor_utils.dart index bd4116b3..9aee74ec 100644 --- a/lib/src/editor/editor_utils.dart +++ b/lib/src/editor/editor_utils.dart @@ -41,6 +41,8 @@ class EditActionDetails { _cropAspectRatio = value; } + double? initialCropAspectRatio; + ///image Rect? get screenDestinationRect => _screenDestinationRect;