Skip to content

Commit

Permalink
change to accept gesture
Browse files Browse the repository at this point in the history
  • Loading branch information
renancaraujo committed Mar 14, 2020
1 parent 03974f7 commit aeac684
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ packages:
path: ".."
relative: true
source: path
version: "0.9.1"
version: "0.9.2"
quiver:
dependency: transitive
description:
Expand Down
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 aeac684

Please sign in to comment.