RTEditor/src/main/java/com/onegravity/rteditor/media/crop/CropImageView.java
private void centerBasedOnHighlightView(HighlightView hv) {
        Rect drawRect = hv.mDrawRect;

        float width = drawRect.width();
        float height = drawRect.height();

        float thisWidth = getWidth();
        float thisHeight = getHeight();

        float z1 = thisWidth / width * .8F;
        float z2 = thisHeight / height * .8F;

        float zoom = Math.min(z1, z2);
        zoom = zoom * this.getScale();
        zoom = Math.max(1F, zoom);
        if ((Math.abs(zoom - getScale()) / zoom) > .1) {
            float[] coordinates = new float[]{hv.mCropRect.centerX(), hv.mCropRect.centerY()};
            getImageMatrix().mapPoints(coordinates);
            zoomTo(zoom, coordinates[0], coordinates[1], 300F);
        }

        ensureVisible(hv);
    }
private void centerBasedOnHighlightView(HighlightView hv) {
        Rect drawRect = hv.mDrawRect;

        float width = drawRect.width();
        float height = drawRect.height();

        float thisWidth = getWidth();
        float thisHeight = getHeight();

        float z1 = thisWidth / width * .8F;
        float z2 = thisHeight / height * .8F;

        float zoom = Math.min(z1, z2);
        zoom = zoom * this.getScale();
        zoom = Math.max(1F, zoom);
        if ((Math.abs(zoom - getScale()) / zoom) > .1) {
            float[] coordinates = new float[]{hv.mCropRect.centerX(), hv.mCropRect.centerY()};
            getImageMatrix().mapPoints(coordinates);
            zoomTo(zoom, coordinates[0], coordinates[1], 300F);
        }

        ensureVisible(hv);
    }
private void centerBasedOnHighlightView ( HighlightView hv ) { Rect drawRect = hv . mDrawRect ; float width = drawRect . width ( ) ; float height = drawRect . height ( ) ; float thisWidth = getWidth ( ) ; float thisHeight = getHeight ( ) ; float z1 = thisWidth / width * .8F ; float z2 = thisHeight / height * .8F ; float zoom = Math . min ( z1 , z2 ) ; zoom = zoom * this . getScale ( ) ; zoom = Math . max ( 1F , zoom ) ; if ( ( Math . abs ( zoom - getScale ( ) ) / zoom ) > .1 ) { float [ ] coordinates = new float [ ] { hv . mCropRect . centerX ( ) , hv . mCropRect . centerY ( ) } ; getImageMatrix ( ) . mapPoints ( coordinates ) ; zoomTo ( zoom , coordinates [ 0 ] , coordinates [ 1 ] , 300F ) ; } ensureVisible ( hv ) ; }
view's center and scale according to the cropping rectangle.
view s center and scale according to the cropping rectangle .