Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to disable gesture detection #233

Closed
sidlatau opened this issue Dec 14, 2019 · 4 comments
Closed

Add ability to disable gesture detection #233

sidlatau opened this issue Dec 14, 2019 · 4 comments
Labels
enhancement New feature or request

Comments

@sidlatau
Copy link
Contributor

Is your feature request related to a problem? Please describe.

I am using photo_view plugin to implement drawing on picture functionality. Use case: user zooms in to specific part of the image and draws something. There are 2 modes - navigate/zoom mode and edit picture mode. I am using PhotoView.customChild constructor. In edit mode child has its own gesture recognizer. Problem is, that in edit mode there are picture view and custom child gesture recognizers in the widgets tree and when the user starts drawing for some time child gesture recognizer does not get events. It starts getting events only when it wins in gesture arena.

Describe the solution you'd like

I want a property PhotoView.disableGestures witch when true removes PhotoView gesture recognizer from the widgets tree.

Describe alternatives you've considered

An alternative solution would be to allow child gesture detector always win. But it would be easier just not to add a gesture recognizer to the widget tree when it is not needed.

Additional context
I was testing reaction to gestures in the app when a child has its own ScaleGestureRecognizer. There is a log with debugPrintGestureArenaDiagnostics = true; Child gesture recognizer wins only after user draged significant distance in the screen. And that distance is lost (no line is drawed in edit mode).

I/flutter (16747): Gesture arena 5    ❙ ★ Opening new gesture arena.
I/flutter (16747): Gesture arena 5    ❙ Adding: ScaleGestureRecognizer#0499e(debugOwner: GestureDetector)
I/flutter (16747): Gesture arena 5    ❙ Adding: PhotoViewGestureRecognizer#f0408(debugOwner: PhotoViewGestureDetector)
I/flutter (16747): Gesture arena 5    ❙ Adding: DoubleTapGestureRecognizer#590d1(debugOwner: PhotoViewGestureDetector)
I/flutter (16747): Gesture arena 5    ❙ Closing with 3 members.
I/flutter (16747): Gesture arena 5    ❙ Rejecting: DoubleTapGestureRecognizer#590d1(debugOwner: PhotoViewGestureDetector)
I/flutter (16747): Gesture arena 5    ❙ Accepting: ScaleGestureRecognizer#0499e(debugOwner: GestureDetector)

@renancaraujo renancaraujo added the enhancement New feature or request label Jan 7, 2020
@votruk
Copy link

votruk commented May 5, 2020

This is a needed feature for me too. @renancaraujo do you have any plans to merge it?

@renancaraujo
Copy link
Member

@votruk Yes, today.

@renancaraujo
Copy link
Member

Merged on 0.10.1

@N00nDay
Copy link

N00nDay commented Jul 8, 2021

How do I disable the gallery swiping? I see how to disable pinch/pan/zoom on individual images but I can't stop the gallery from swiping.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants