@@ -850,6 +850,7 @@ class TapAndDragGestureRecognizer extends OneSequenceGestureRecognizer with _Tap
850
850
// Tap related state.
851
851
bool _pastSlopTolerance = false ;
852
852
bool _sentTapDown = false ;
853
+ bool _wonArenaForPrimaryPointer = false ;
853
854
854
855
// Primary pointer being tracked by this recognizer.
855
856
int ? _primaryPointer;
@@ -934,7 +935,7 @@ class TapAndDragGestureRecognizer extends OneSequenceGestureRecognizer with _Tap
934
935
void handleNonAllowedPointer (PointerDownEvent event) {
935
936
// There can be multiple drags simultaneously. Their effects are combined.
936
937
if (event.buttons != kPrimaryButton) {
937
- if (! _sentTapDown ) {
938
+ if (! _wonArenaForPrimaryPointer ) {
938
939
super .handleNonAllowedPointer (event);
939
940
}
940
941
}
@@ -956,6 +957,8 @@ class TapAndDragGestureRecognizer extends OneSequenceGestureRecognizer with _Tap
956
957
_checkTapDown (currentDown! );
957
958
}
958
959
960
+ _wonArenaForPrimaryPointer = true ;
961
+
959
962
if (_start != null ) {
960
963
_acceptDrag (_start! );
961
964
}
@@ -976,7 +979,7 @@ class TapAndDragGestureRecognizer extends OneSequenceGestureRecognizer with _Tap
976
979
case _DragState .possible:
977
980
if (_pastSlopTolerance) {
978
981
// This means the pointer was not accepted as a tap.
979
- if (_sentTapDown ) {
982
+ if (_wonArenaForPrimaryPointer ) {
980
983
// If the recognizer has already won the arena for the primary pointer being tracked
981
984
// but the pointer has exceeded the tap tolerance, then the pointer is accepted as a
982
985
// drag gesture.
@@ -1043,7 +1046,7 @@ class TapAndDragGestureRecognizer extends OneSequenceGestureRecognizer with _Tap
1043
1046
1044
1047
// This can occur when the recognizer is accepted before a [PointerMoveEvent] has been
1045
1048
// received that moves the pointer a sufficient global distance to be considered a drag.
1046
- if (_start != null && _sentTapDown ) {
1049
+ if (_start != null ) {
1047
1050
_acceptDrag (_start! );
1048
1051
}
1049
1052
}
@@ -1085,6 +1088,9 @@ class TapAndDragGestureRecognizer extends OneSequenceGestureRecognizer with _Tap
1085
1088
String get debugDescription => 'tap_and_drag' ;
1086
1089
1087
1090
void _acceptDrag (PointerEvent event) {
1091
+ if (! _wonArenaForPrimaryPointer) {
1092
+ return ;
1093
+ }
1088
1094
_dragState = _DragState .accepted;
1089
1095
if (dragStartBehavior == DragStartBehavior .start) {
1090
1096
_initialPosition = _initialPosition + OffsetPair (global: event.delta, local: event.localDelta);
@@ -1138,7 +1144,7 @@ class TapAndDragGestureRecognizer extends OneSequenceGestureRecognizer with _Tap
1138
1144
}
1139
1145
1140
1146
void _checkTapUp (PointerUpEvent event) {
1141
- if (! _sentTapDown ) {
1147
+ if (! _wonArenaForPrimaryPointer ) {
1142
1148
return ;
1143
1149
}
1144
1150
@@ -1265,6 +1271,7 @@ class TapAndDragGestureRecognizer extends OneSequenceGestureRecognizer with _Tap
1265
1271
1266
1272
void _resetTaps () {
1267
1273
_sentTapDown = false ;
1274
+ _wonArenaForPrimaryPointer = false ;
1268
1275
_primaryPointer = null ;
1269
1276
}
1270
1277
0 commit comments