Skip to content

Commit

Permalink
Changed calculation for min scale.
Browse files Browse the repository at this point in the history
  • Loading branch information
shliama committed Sep 8, 2016
1 parent d281009 commit a2a8669
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.util.Log;

import com.yalantis.ucrop.R;
import com.yalantis.ucrop.callback.BitmapCropCallback;
Expand Down Expand Up @@ -461,10 +462,11 @@ private void calculateImageScaleBounds() {
* @param drawableHeight - image height
*/
private void calculateImageScaleBounds(float drawableWidth, float drawableHeight) {
float widthScale = mCropRect.width() / drawableWidth;
float heightScale = mCropRect.height() / drawableHeight;
float widthScale = Math.min(mCropRect.width() / drawableWidth, mCropRect.width() / drawableHeight);
float heightScale = Math.min(mCropRect.height() / drawableHeight, mCropRect.height() / drawableWidth);

mMinScale = Math.max(widthScale, heightScale);
mMinScale = Math.min(widthScale, heightScale);
Log.d("WTF", "MIN SCALE : " + mMinScale);
mMaxScale = mMinScale * mMaxScaleMultiplier;
}

Expand Down

0 comments on commit a2a8669

Please sign in to comment.