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

Fix(#212) GestureDetector winning arena #266

Merged
merged 1 commit into from
Mar 23, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions lib/src/core/photo_view_gesture_detector.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ class PhotoViewGestureDetector extends StatelessWidget {

gestures[PhotoViewGestureRecognizer] =
GestureRecognizerFactoryWithHandlers<PhotoViewGestureRecognizer>(
() => PhotoViewGestureRecognizer(hitDetector, this, axis),
() => PhotoViewGestureRecognizer(
hitDetector: hitDetector, debugOwner: this, validateAxis: axis),
(PhotoViewGestureRecognizer instance) {
instance
..onStart = onScaleStart
Expand All @@ -80,11 +81,12 @@ class PhotoViewGestureDetector extends StatelessWidget {
}

class PhotoViewGestureRecognizer extends ScaleGestureRecognizer {
PhotoViewGestureRecognizer(
PhotoViewGestureRecognizer({
this.hitDetector,
Object debugOwner,
this.validateAxis,
) : super(debugOwner: debugOwner);
PointerDeviceKind kind,
}) : super(debugOwner: debugOwner, kind: kind);
final HitCornersDetector hitDetector;
final Axis validateAxis;

Expand Down Expand Up @@ -152,12 +154,12 @@ class PhotoViewGestureRecognizer extends ScaleGestureRecognizer {
? hitDetector.shouldMoveY(move)
: hitDetector.shouldMoveX(move);
if (shouldMove || _pointerLocations.keys.length > 1) {
resolve(GestureDisposition.accepted);
acceptGesture(event.pointer);
}
}
}

/// An [InheritedWidget] responsible to give a axis aware scope to the internal[GestureRecognizer].
/// An [InheritedWidget] responsible to give a axis aware scope to [PhotoViewGestureRecognizer].
///
/// When using this, PhotoView will test if the content zoomed has hit edge every time user pinches,
/// if so, it will let parent gesture detectors win the gesture arena
Expand Down