Skip to content

Commit

Permalink
Fix small regression to aspect ratio min dimensions
Browse files Browse the repository at this point in the history
  • Loading branch information
sekoyo committed Aug 31, 2023
1 parent f961ca7 commit ca4bf90
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
7 changes: 2 additions & 5 deletions src/ReactCrop.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -559,13 +559,10 @@ export class ReactCrop extends PureComponent<ReactCropProps, ReactCropState> {
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]
}
}

Expand Down

0 comments on commit ca4bf90

Please sign in to comment.