zoom_pinch_overlay icon indicating copy to clipboard operation
zoom_pinch_overlay copied to clipboard

Zooming should have priority over changing pages

Open tkortekaas opened this issue 3 years ago • 5 comments

First of all great job on this plugin. I am the developer of a similar plugin called pinch_zoom, but I was always struggling with some issues that this plugin doesn't have. Only one issue that my plugin managed to solve by using the InteractiveViewer, this plugin still has. Hopefully you might know a solution to this.

Describe the bug When zooming in on an image in a PageView, the page will change instead of the image zooming in. Possibly this could be resolved using the OneSequenceGestureRecognizer or MultiDragGestureRecognizer. In my plugin I managed to solve this even more when using the answer provided in https://stackoverflow.com/questions/51712287/how-to-disable-multi-touch-in-mobile-application-using-flutter/56037327#56037327, which I had to use since I couldn't solve the issue using GestureRecognizer solutions, simply since my plugin uses the InteractiveViewer and not that one.

To Reproduce Steps to reproduce the behavior:

  1. Add a PageView.builder() with multiple pages
  2. Add an image wrapped by the ZoomOverlay() to one of these pages
  3. Try zooming in on this image. Try with both more vertical and horizontal zooming.
  4. Though it works better with twoTouchOnly, you shall notice that the PageView tends to have priority over the zooming of the ZoomOverlay(). It also works better when zooming vertically.

Expected behavior The image will zoom in instead of the page changing

tkortekaas avatar May 28 '21 08:05 tkortekaas

I have tried to reproduce it but it seems okay when zooming.

https://user-images.githubusercontent.com/68549184/119984532-16c70800-bff4-11eb-96fb-73b5fad917bb.mp4

Mayb3Nots avatar May 28 '21 12:05 Mayb3Nots

@Mayb3Nots You are using ListView, the bug he encounter is within PageView ... I think you should

This enhancement might solve this issue, disable all existing touch event when 2 finger tapped on the Image https://github.com/Mayb3Nots/zoom_pinch_overlay/issues/5

sooxt98 avatar May 29 '21 01:05 sooxt98

@Mayb3Nots You are using ListView, the bug he encounter is within PageView ... I think you should

This enhancement might solve this issue, disable all existing touch event when 2 finger tapped on the Image #5

The video I showed you was using PageView. Can you guys provide a simple reproduction code

Mayb3Nots avatar May 29 '21 05:05 Mayb3Nots

The following code contains the problem that I tried showing + another weird behaviour. I was about to already file a new report on this, namely that the overlay entry doesn't spawn in the correct place when it is in an expanded widget.

You can't see that in the video, but I constantly tried zooming in with different angles using 2 fingers.

return Scaffold(
      appBar: AppBar(),
      body: PageView(
        children: [
          Container(
            width: MediaQuery.of(context).size.width,
            height: MediaQuery.of(context).size.height,
            color: Colors.blue,
          ),
          Column(
            children: [
              Expanded(
                child: ZoomOverlay(
                  child: Image.network('http://placekitten.com/g/300/200'),
                ),
              ),
            ],
          ),
          Container(
            width: MediaQuery.of(context).size.width,
            height: MediaQuery.of(context).size.height,
            color: Colors.red,
          )
        ],
      ),
    );

Video:

https://user-images.githubusercontent.com/37802918/120060718-9d620080-c059-11eb-99a4-029133b193bb.mp4

tkortekaas avatar May 29 '21 06:05 tkortekaas

Hello! Any update on this? It's even worse when you put the PageView in a ListView.

VictorHoMetacrew avatar Jan 10 '24 01:01 VictorHoMetacrew