Skip to content

Commit

Permalink
Fix issue CrackerakiUA#81 - init-max-area with an aspect-ratio lower …
Browse files Browse the repository at this point in the history
…than 1 not working
  • Loading branch information
BORDIGA Timothé committed Nov 21, 2018
1 parent 811c834 commit 75daa4c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions source/js/classes/crop-area.js
Original file line number Diff line number Diff line change
Expand Up @@ -377,14 +377,20 @@ angular.module('uiCropper').factory('cropArea', ['cropCanvas', function (CropCan
};
}
var width = size.w;
var height = size.h;
if (this._aspect) {
width = size.h * this._aspect;
// In order to apply the initMax from the crop-host we need to update the width only when the aspect ratio is above 1.
if (this.aspect >= 1) {
width = size.h * this._aspect;
} else {
height = size.w / this._aspect;
}
}
return {
x: (typeof size.x === 'undefined') ? this.getSize().x : size.x,
y: (typeof size.y === 'undefined') ? this.getSize().y : size.y,
w: width || this._minSize.w,
h: size.h || this._minSize.h
h: height || this._minSize.h
};
};

Expand Down

0 comments on commit 75daa4c

Please sign in to comment.