Skip to content

Commit

Permalink
change to accept gesture (#266)
Browse files Browse the repository at this point in the history
  • Loading branch information
renancaraujo authored Mar 23, 2020
1 parent d33b394 commit 5cbd22f
Showing 1 changed file with 7 additions and 5 deletions.
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

0 comments on commit 5cbd22f

Please sign in to comment.