Skip to content

Commit

Permalink
Build
Browse files Browse the repository at this point in the history
  • Loading branch information
sekoyo committed Nov 13, 2018
1 parent 375dddf commit d89eaf0
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 16 deletions.
11 changes: 8 additions & 3 deletions demo/demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ function loadEditView(dataUrl) {
x: 20,
y: 10,
width: 40,
aspect: 16 / 9,
height: 40,
// aspect: 16 / 9,
},
maxHeight: 80,
disabled: false,
}

onButtonClick = () => {
Expand Down Expand Up @@ -70,7 +71,11 @@ function loadEditView(dataUrl) {
return (
<div>
<ReactCrop
{...this.state}
crop={this.state.crop}
disabled={this.state.disabled}
maxHeight={80}
minHeight={20}
minWidth={20}
className="ACustomClassA ACustomClassB"
src={dataUrl}
onImageLoaded={this.onImageLoaded}
Expand Down
39 changes: 27 additions & 12 deletions dist/ReactCrop.js
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,9 @@ var ReactCrop = function (_PureComponent) {
nextCrop = _this.dragCrop();
}

onChange(nextCrop, getPixelCrop(_this.imageRef, nextCrop));
if (nextCrop !== crop) {
onChange(nextCrop, getPixelCrop(_this.imageRef, nextCrop));
}
}, _this.onComponentKeyDown = function (e) {
var _this$props4 = _this.props,
crop = _this$props4.crop,
Expand Down Expand Up @@ -644,6 +646,10 @@ var ReactCrop = function (_PureComponent) {
value: function resizeCrop() {
var nextCrop = this.makeNewCrop();
var evData = this.evData;
var _props2 = this.props,
crop = _props2.crop,
minWidth = _props2.minWidth,
minHeight = _props2.minHeight;
var ord = evData.ord;

var imageAspect = this.imageRef.width / this.imageRef.height;
Expand Down Expand Up @@ -702,6 +708,15 @@ var ReactCrop = function (_PureComponent) {
nextCrop.height = containedCrop.height;
}

// Ensure new dimensions aren't less than min dimensions.
if (minWidth && nextCrop.width < minWidth) {
return crop;
}

if (minHeight && nextCrop.height < minHeight) {
return crop;
}

evData.lastYCrossover = evData.yCrossOver;
this.crossOverCheck();
return nextCrop;
Expand Down Expand Up @@ -797,17 +812,17 @@ var ReactCrop = function (_PureComponent) {
value: function render() {
var _this4 = this;

var _props2 = this.props,
children = _props2.children,
className = _props2.className,
crossorigin = _props2.crossorigin,
crop = _props2.crop,
disabled = _props2.disabled,
imageAlt = _props2.imageAlt,
onImageError = _props2.onImageError,
src = _props2.src,
style = _props2.style,
imageStyle = _props2.imageStyle;
var _props3 = this.props,
children = _props3.children,
className = _props3.className,
crossorigin = _props3.crossorigin,
crop = _props3.crop,
disabled = _props3.disabled,
imageAlt = _props3.imageAlt,
onImageError = _props3.onImageError,
src = _props3.src,
style = _props3.style,
imageStyle = _props3.imageStyle;
var cropIsActive = this.state.cropIsActive;

var cropSelection = void 0;
Expand Down
Loading

0 comments on commit d89eaf0

Please sign in to comment.