SuperImageView icon indicating copy to clipboard operation
SuperImageView copied to clipboard

Bug-

Open AnBetter2021 opened this issue 4 years ago • 0 comments

[BUG] 尊敬的开发者你好:

  • Bug 1、 ImageCroppingActivity中Left Top crop of the horizontal image、Left Center crop of the horizontal image、Left Top crop of the horizontal image,发现三种裁剪和显示方式都是一样的。没有任何区别。 2、Right Top crop of the horizontal image、Right Center crop of the horizontal image、Right Top crop of the horizontal image三种裁剪和显示方式都是一样的,没有任何区别。 3、请检查是否裁剪算法错误。未实现标注的裁剪和显示方式 com.codeforvictory.android.superimageview.crop.ImageTransformation void compute(@CropType int cropType) { int viewWidth = view.getWidth() - view.getPaddingLeft() - view.getPaddingRight(); int viewHeight = view.getHeight() - view.getPaddingTop() - view.getPaddingBottom();

    if (cropType != CropType.NONE && viewHeight > 0 && viewWidth > 0) {
        Matrix matrix = compatMatrix.matrix(cropType);
    
        Drawable drawable = view.getDrawable();
        int drawableWidth = drawable.getIntrinsicWidth();
        int drawableHeight = drawable.getIntrinsicHeight();
    
        float scaleY = (float) viewHeight / (float) drawableHeight;
        float scaleX = (float) viewWidth / (float) drawableWidth;
        float scale = scaleX > scaleY ? scaleX : scaleY;
        matrix.setScale(scale, scale); // Same as doing matrix.reset() and matrix.preScale(...)
    
        boolean verticalImageMode = scaleX > scaleY;
    
        float xTranslation = getXTranslation(
            cropType,
            viewWidth,
            drawableWidth * scale,
            verticalImageMode
        );
        float yTranslation = getYTranslation(
            cropType,
            viewHeight,
            drawableHeight * scale,
            verticalImageMode
        );
    
        matrix.postTranslate(xTranslation, yTranslation);
        view.setImageMatrix(matrix);
    }
    

    }

AnBetter2021 avatar May 10 '21 03:05 AnBetter2021