Skip to content

Commit

Permalink
Added min size fix jamesssooi#40
Browse files Browse the repository at this point in the history
  • Loading branch information
mullema committed Sep 9, 2019
1 parent df27b32 commit d97ceba
Show file tree
Hide file tree
Showing 6 changed files with 4,589 additions and 10 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.DS_Store
.idea

# Logs
logs
Expand Down
9 changes: 6 additions & 3 deletions dist/croppr.js
Original file line number Diff line number Diff line change
Expand Up @@ -856,12 +856,15 @@ var CropprCore = function () {
var ratioMode = isVerticalMovement ? 'width' : 'height';
box.constrainToRatio(ratio, origin, ratioMode);
}
var min = this.options.minSize;
var max = this.options.maxSize;
box.constrainToSize(max.width, max.height, min.width, min.height, origin, this.options.aspectRatio);
var parentWidth = this.cropperEl.offsetWidth;
var parentHeight = this.cropperEl.offsetHeight;
box.constrainToBoundary(parentWidth, parentHeight, origin);
var min = this.options.minSize;
var max = this.options.maxSize;
box.constrainToSize(max.width, max.height, min.width, min.height, origin, this.options.aspectRatio);
if (box.x1 < 0 || box.y1 < 0 || box.x2 > Math.ceil(container.width) || box.y2 > Math.ceil(container.height)) {
return;
}
this.box = box;
this.redraw();
if (this.options.onCropMove !== null) {
Expand Down
2 changes: 1 addition & 1 deletion dist/croppr.min.js

Large diffs are not rendered by default.

Loading

0 comments on commit d97ceba

Please sign in to comment.