Closed bkasodariya closed 9 years ago
Hi André,
Tried to crop different size images. It returns wrong coordinate when image width is less than maxwidth. to fix that, added extra width check in getShrinkRatio function.
$scope.getShrinkRatio = function(){ var img = $('<img>').attr('src', $scope.mainImg[0].src)[0]; var widthShrinkRatio = img.width / ngJcropConfig.jcrop.maxWidth, heightShrinkRatio = img.height / ngJcropConfig.jcrop.maxHeight, widthConstraining = img.width > ngJcropConfig.jcrop.maxWidth && widthShrinkRatio > heightShrinkRatio; //fix if(ngJcropConfig.jcrop.maxWidth>img.width || ngJcropConfig.jcrop.maxHeight>img.height){ return 1; } if(widthConstraining) { return widthShrinkRatio; } else { return heightShrinkRatio; } };
Hi André,
Tried to crop different size images. It returns wrong coordinate when image width is less than maxwidth. to fix that, added extra width check in getShrinkRatio function.