Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@uppy/image-editor: respect cropperOptions.initialAspectRatio #4805

Merged
merged 8 commits into from
Nov 27, 2023
Merged
4 changes: 2 additions & 2 deletions packages/@uppy/image-editor/src/Editor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ export default class Editor extends Component {
}

renderRevert () {
const { i18n } = this.props
const { i18n, opts } = this.props

return (
<label
Expand All @@ -140,7 +140,7 @@ export default class Editor extends Component {
className="uppy-u-reset uppy-c-btn"
onClick={() => {
this.cropper.reset()
this.cropper.setAspectRatio(0)
this.cropper.setAspectRatio(opts.cropperOptions.initialAspectRatio);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it go through the linter fine? I think it should compain about ;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sorry, it was my oversight.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can I pass the review now?

this.setState({ angle90Deg: 0, angleGranular: 0 })
}}
>
Expand Down
1 change: 1 addition & 0 deletions packages/@uppy/image-editor/src/ImageEditor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export default class ImageEditor extends UIPlugin {
minCropBoxWidth: 70,
minCropBoxHeight: 70,
croppedCanvasOptions: {},
initialAspectRatio: 0,
}

const defaultActions = {
Expand Down