BigImageViewer icon indicating copy to clipboard operation
BigImageViewer copied to clipboard

Double Click zoom is not zooming in with 'centerInside' scale type.

Open DominList opened this issue 7 years ago • 4 comments

Double Click zoom is not zooming in with 'centerInside' value for 'initScaleType'. I want to show full image on the screen and give an ability that user can tap it twice to see the details.

DominList avatar Jan 22 '18 10:01 DominList

You mean making the tapped position become center of screen after zooming in?

Actually that's SSIV's feature, you can read its doc, or submit a issue here: https://github.com/davemorrissey/subsampling-scale-image-view

Piasy avatar Jan 26 '18 00:01 Piasy

No. That can be another topic. I mean it doesn't work at all with initScaleType="centerInside". Reaction for image tapped twice is none or insignificant.

DominList avatar Jan 26 '18 08:01 DominList

Double tap to zoom is working fine for the same image in SSIV(typically the image is of height>>width such that the center fit is on the basis of height) but the image is not zooming on double tap in BigImage..

Gauravv97 avatar Mar 06 '18 17:03 Gauravv97

I think it's because SubsamplingScaleImageView.this.doubleTapZoomScale is always 1. So this line in the doubleTapZoom will always zoom to 1. float doubleTapZoomScale = Math.min(maxScale, SubsamplingScaleImageView.this.doubleTapZoomScale); Because this value will be set in DisplayOptimizeListener.onReady which was called in SubsamplingScaleImageView.onImageLoaded.

This is how I make it work.

imageSliderImageView.setImageLoaderCallback(new ImageLoader.Callback() {
            @Override
            public void onCacheHit(int imageType, File image) {

            }

            @Override
            public void onCacheMiss(int imageType, File image) {

            }

            @Override
            public void onStart() {

            }

            @Override
            public void onProgress(int progress) {

            }

            @Override
            public void onFinish() {

            }

            @Override
            public void onSuccess(File image) {
                final SubsamplingScaleImageView view = imageSliderImageView.getSSIV();

                if( view != null ){
                    view.setMinimumDpi(80);

                    view.setOnImageEventListener(new SubsamplingScaleImageView.OnImageEventListener() {
                        @Override
                        public void onReady() {

                        }

                        @Override
                        public void onImageLoaded() {
                            view.setDoubleTapZoomDpi(80);
                            view.setDoubleTapZoomDuration(200);
                            view.setDoubleTapZoomStyle(ZOOM_FOCUS_FIXED);
                            view.setQuickScaleEnabled(false);
                        }

                        @Override
                        public void onPreviewLoadError(Exception e) {

                        }

                        @Override
                        public void onImageLoadError(Exception e) {

                        }

                        @Override
                        public void onTileLoadError(Exception e) {

                        }

                        @Override
                        public void onPreviewReleased() {

                        }
                    });
                }
            }

            @Override
            public void onFail(Exception error) {

            }
        });

KimiChiu avatar Nov 08 '18 13:11 KimiChiu