A responsive image cropping tool for React
ISC License
Published by DominicTobias almost 7 years ago
/dist
bundles. The minified prod build was in the wrong file so it's now swapped and correct #138Published by DominicTobias almost 7 years ago
Published by DominicTobias almost 7 years ago
/dist
).Published by DominicTobias almost 7 years ago
React
vs react
casing warning.Update: This version shouldn't be used when consuming the /dist module (e.g. via a CDN)
Published by DominicTobias almost 7 years ago
(No functional changes to code)
Published by DominicTobias about 7 years ago
Published by DominicTobias about 7 years ago
onImageLoaded
in the case where the browser has cached the imagePublished by DominicTobias about 7 years ago
You must always implement onChange
and update the crop state, ReactCrop no longer maintains the crop in it's own state. This is in an effort to make the component more pure and predictable.
Due to this change if you specify an aspect
you can either omit width
and height
, or you must specify both. This is because the crop object is now an immutable prop and ReactCrop can't fill it in for you. If you don't know the ratio of the image you should set the crop from inside onImageLoaded
:
import ReactCrop, { makeAspectCrop } from 'react-image-crop';
onImageLoaded = (image) => {
this.setState({
crop: makeAspectCrop({
x: 0,
y: 0,
aspect: 16 / 9,
width: 50,
}, image.width / image.height),
});
}
onImageLoaded
only passes the image element as the first parameter.
A copy of the image is no longer rendered, increasing performance particularly in the case of a base64 image.
keepSelection
will not remove the crop even when dragging outside the crop (not just clicking). It also won't hide the resize handles whilst clicking down outside the crop which was causing a flickering effect.
ReactCrop--new-crop
class changed to ReactCrop--active
and on if resizing a crop too.
Fixed crop continuing to expand when resizing movement goes outside the image bounds
Published by DominicTobias about 7 years ago
Published by DominicTobias about 7 years ago
pixelCrop
Published by DominicTobias about 7 years ago
Update peer dep to allow React v16
2.0.6 was a mistaken publish (but harmless)
Published by DominicTobias over 7 years ago
onAspectRatioChange
not being called when going from a falsy to truthy value #101Published by DominicTobias over 7 years ago
prop-types
package to fix deprecation warning #97Published by DominicTobias over 7 years ago
Updates (Breaking for CSS):
Note: All CSS classes have been renamed from ReactCrop--
to ReactCrop__
so if you were overriding CSS you'll have to adjust your class names.
Published by DominicTobias over 7 years ago
Fixes:
dist/ReactCrop.js
went missing from the 2.0.1
release. Note that dist/
is now only included in the npm install.Published by DominicTobias over 7 years ago
Fixes:
Published by DominicTobias over 7 years ago
Breaking changes:
crossorigin
default (was "anonymous"
which was causing issues #62)Updates:
Published by DominicTobias almost 8 years ago
onAspectRatioChange
callback #76Published by DominicTobias about 8 years ago
Missing build step for regression fix for crossOrigin tag #68