Skip to content

Commit

Permalink
Remove unnecessary code
Browse files Browse the repository at this point in the history
  • Loading branch information
tneotia committed Feb 13, 2021
1 parent 86ac375 commit 29668fb
Showing 1 changed file with 1 addition and 40 deletions.
41 changes: 1 addition & 40 deletions lib/src/replaced_element.dart
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class IframeContentElement extends ReplacedElement {
: JavascriptMode.disabled,
navigationDelegate: navigationDelegate,
gestureRecognizers: {
Factory(() => PlatformViewVerticalGestureRecognizer())
Factory<VerticalDragGestureRecognizer>(() => VerticalDragGestureRecognizer()),
},
),
);
Expand Down Expand Up @@ -372,42 +372,3 @@ ReplacedElement parseReplacedElement(
return EmptyContentElement(name: element.localName);
}
}

// TODO(Sub6Resources): Remove when https://github.com/flutter/flutter/issues/36304 is resolved
class PlatformViewVerticalGestureRecognizer
extends VerticalDragGestureRecognizer {
PlatformViewVerticalGestureRecognizer({PointerDeviceKind kind})
: super(kind: kind);

Offset _dragDistance = Offset.zero;

@override
void addPointer(PointerEvent event) {
startTrackingPointer(event.pointer);
}

@override
void handleEvent(PointerEvent event) {
_dragDistance = _dragDistance + event.delta;
if (event is PointerMoveEvent) {
final double dy = _dragDistance.dy.abs();
final double dx = _dragDistance.dx.abs();

if (dy > dx && dy > kTouchSlop) {
// vertical drag - accept
resolve(GestureDisposition.accepted);
_dragDistance = Offset.zero;
} else if (dx > kTouchSlop && dx > dy) {
// horizontal drag - stop tracking
stopTrackingPointer(event.pointer);
_dragDistance = Offset.zero;
}
}
}

@override
String get debugDescription => 'horizontal drag (platform view)';

@override
void didStopTrackingLastPointer(int pointer) {}
}

0 comments on commit 29668fb

Please sign in to comment.