diff --git a/package.json b/package.json index 14f1f84..221ca32 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-image-crop", - "version": "10.1.7", + "version": "10.1.8", "description": "A responsive image cropping tool for React", "repository": "https://github.com/DominicTobias/react-image-crop", "type": "module", diff --git a/src/ReactCrop.tsx b/src/ReactCrop.tsx index 4e7d8df..f869bb5 100644 --- a/src/ReactCrop.tsx +++ b/src/ReactCrop.tsx @@ -559,13 +559,10 @@ export class ReactCrop extends PureComponent { return [mw, mh] } - const longestSide = Math.max(mw, mh) - - // Use the larger side and infer the other if (aspect > 1) { - return [longestSide, longestSide / aspect] + return mw ? [mw, mw / aspect] : [mh * aspect, mh] } else { - return [longestSide * aspect, longestSide] + return mh ? [mh * aspect, mh] : [mw, mw / aspect] } }