Skip to content

Commit

Permalink
InvalidRectError - floating point error Issue #152 (#153)
Browse files Browse the repository at this point in the history
Co-authored-by: Chooyan <[email protected]>
  • Loading branch information
Lenkomotive and chooyan-eng authored Dec 9, 2024
1 parent 5a0d71d commit 2339dc0
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions lib/src/logic/cropper/image_image_cropper.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import 'dart:async';
import 'dart:math';

import 'dart:typed_data';

import 'dart:ui';

import 'package:crop_your_image/src/logic/cropper/errors.dart';
Expand All @@ -24,10 +22,10 @@ class ImageImageCropper extends ImageCropper<Image> {
ImageFormat outputFormat = ImageFormat.jpeg,
ImageShape shape = ImageShape.rectangle,
}) {
if (topLeft.dx.isNegative ||
topLeft.dy.isNegative ||
bottomRight.dx.isNegative ||
bottomRight.dy.isNegative ||
if (topLeft.dx.toInt().isNegative ||
topLeft.dy.toInt().isNegative ||
bottomRight.dx.toInt().isNegative ||
bottomRight.dy.toInt().isNegative ||
topLeft.dx.toInt() > original.width ||
topLeft.dy.toInt() > original.height ||
bottomRight.dx.toInt() > original.width ||
Expand Down

0 comments on commit 2339dc0

Please sign in to comment.