steelkiwi / cropiwa

📐 Configurable Custom Crop widget for Android
http://steelkiwi.com/
2.23k stars 330 forks source link

Small image can't scale #3

Closed AnswerZhao closed 7 years ago

AnswerZhao commented 7 years ago

When the loaded photo is too small , the image can't scale by touching.

vellrya commented 7 years ago

I confirm. Video: http://dropmefiles.com/UEQjI Scale and translation gesture are activated.

polyak01 commented 7 years ago

cropView.configureImage() .setMinScale(minScale) .setMaxScale(maxScale) .apply();



Try to decrease minScale / increase maxScale
AnswerZhao commented 7 years ago

@polyak01 It can't works.

polyak01 commented 7 years ago

@AnswerZhao do you try to setMinScale(0.1f)?

AnswerZhao commented 7 years ago

@polyak01 float scaleFactor = detector.getScaleFactor(); float newScale = matrixUtils.getScaleX(imageMatrix) * scaleFactor; When the photo is too small, the newScale value is too lager than the maxScale.(70*70Px, the newScale is 25), so i think the scale value is not perfect. I change the method isValidScal() to resolve it finally.

vellrya commented 7 years ago

@polyak01 I set MaxScale to 9f (minimum value at which it start working with my (409*103) picture) and MinScale to 0f. It works, but it works strange. Until I set the frame with the same aspect ratio as the picture itself, I can not reduce the image. In addition, scale gestures work only outside the crop area. (Video: http://dropmefiles.com/DbG2d)

AnswerZhao commented 7 years ago

@vellrya 9 is not work for everything, you can try a 43*43 picture.

vellrya commented 7 years ago

Okay. I decided for myself this problem. I completely removed Min and Maxscale and did this:

cropView.configureOverlay()
                .setAspectRatio(AspectRatio.IMG_SRC)
                .apply()

Now I can correctly move and scale small pictures. (http://dropmefiles.com/KQByj) It remains only to wait for the ability to rotate pictures in this library)

polyak01 commented 7 years ago

@AnswerZhao Did you solved the problem?

AnswerZhao commented 7 years ago

@polyak01 Yep. You can change the implement of the method isValidScal() ,or increase the maxScale, or remove the limits of maxScale.