Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
onImageLoaded = image => {
const { cropShape } = this.props
let { crop } = this.props
// when the shape is a circle the aspect should be 1
if (cropShape === 'circle') {
crop = { ...crop, aspect: 1 }
}
const cropProperties = makeAspectCrop(
{
...crop,
},
image.width / image.height
)
const pixelToCrop = getPixelCrop(image, cropProperties)
this.setState({
crop: cropProperties,
originalImage: image,
pixelCrop: pixelToCrop,
})
}