Skip to content

Commit ca4bf90

Browse files
committed
Fix small regression to aspect ratio min dimensions
1 parent f961ca7 commit ca4bf90

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-image-crop",
3-
"version": "10.1.7",
3+
"version": "10.1.8",
44
"description": "A responsive image cropping tool for React",
55
"repository": "https://github.com/DominicTobias/react-image-crop",
66
"type": "module",

src/ReactCrop.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -559,13 +559,10 @@ export class ReactCrop extends PureComponent<ReactCropProps, ReactCropState> {
559559
return [mw, mh]
560560
}
561561

562-
const longestSide = Math.max(mw, mh)
563-
564-
// Use the larger side and infer the other
565562
if (aspect > 1) {
566-
return [longestSide, longestSide / aspect]
563+
return mw ? [mw, mw / aspect] : [mh * aspect, mh]
567564
} else {
568-
return [longestSide * aspect, longestSide]
565+
return mh ? [mh * aspect, mh] : [mw, mw / aspect]
569566
}
570567
}
571568

0 commit comments

Comments
 (0)