Piasy / BigImageViewer

Big image viewer supporting pan and zoom, with very little memory usage and full featured image loading choices. Powered by Subsampling Scale Image View, Fresco, Glide, and Picasso. Even with gif and webp support! 🍻
MIT License
3.97k stars 400 forks source link

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

Open DominList opened 6 years ago

DominList commented 6 years ago

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.

Piasy commented 6 years ago

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

DominList commented 6 years ago

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.

Gauravv97 commented 6 years ago

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..

KimiChiu commented 5 years ago

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) {

            }
        });