@@ -850,6 +850,7 @@ class TapAndDragGestureRecognizer extends OneSequenceGestureRecognizer with _Tap
850850 // Tap related state.
851851 bool _pastSlopTolerance = false ;
852852 bool _sentTapDown = false ;
853+ bool _wonArenaForPrimaryPointer = false ;
853854
854855 // Primary pointer being tracked by this recognizer.
855856 int ? _primaryPointer;
@@ -934,7 +935,7 @@ class TapAndDragGestureRecognizer extends OneSequenceGestureRecognizer with _Tap
934935 void handleNonAllowedPointer (PointerDownEvent event) {
935936 // There can be multiple drags simultaneously. Their effects are combined.
936937 if (event.buttons != kPrimaryButton) {
937- if (! _sentTapDown ) {
938+ if (! _wonArenaForPrimaryPointer ) {
938939 super .handleNonAllowedPointer (event);
939940 }
940941 }
@@ -956,6 +957,8 @@ class TapAndDragGestureRecognizer extends OneSequenceGestureRecognizer with _Tap
956957 _checkTapDown (currentDown! );
957958 }
958959
960+ _wonArenaForPrimaryPointer = true ;
961+
959962 if (_start != null ) {
960963 _acceptDrag (_start! );
961964 }
@@ -976,7 +979,7 @@ class TapAndDragGestureRecognizer extends OneSequenceGestureRecognizer with _Tap
976979 case _DragState .possible:
977980 if (_pastSlopTolerance) {
978981 // This means the pointer was not accepted as a tap.
979- if (_sentTapDown ) {
982+ if (_wonArenaForPrimaryPointer ) {
980983 // If the recognizer has already won the arena for the primary pointer being tracked
981984 // but the pointer has exceeded the tap tolerance, then the pointer is accepted as a
982985 // drag gesture.
@@ -1043,7 +1046,7 @@ class TapAndDragGestureRecognizer extends OneSequenceGestureRecognizer with _Tap
10431046
10441047 // This can occur when the recognizer is accepted before a [PointerMoveEvent] has been
10451048 // received that moves the pointer a sufficient global distance to be considered a drag.
1046- if (_start != null && _sentTapDown ) {
1049+ if (_start != null ) {
10471050 _acceptDrag (_start! );
10481051 }
10491052 }
@@ -1085,6 +1088,9 @@ class TapAndDragGestureRecognizer extends OneSequenceGestureRecognizer with _Tap
10851088 String get debugDescription => 'tap_and_drag' ;
10861089
10871090 void _acceptDrag (PointerEvent event) {
1091+ if (! _wonArenaForPrimaryPointer) {
1092+ return ;
1093+ }
10881094 _dragState = _DragState .accepted;
10891095 if (dragStartBehavior == DragStartBehavior .start) {
10901096 _initialPosition = _initialPosition + OffsetPair (global: event.delta, local: event.localDelta);
@@ -1138,7 +1144,7 @@ class TapAndDragGestureRecognizer extends OneSequenceGestureRecognizer with _Tap
11381144 }
11391145
11401146 void _checkTapUp (PointerUpEvent event) {
1141- if (! _sentTapDown ) {
1147+ if (! _wonArenaForPrimaryPointer ) {
11421148 return ;
11431149 }
11441150
@@ -1265,6 +1271,7 @@ class TapAndDragGestureRecognizer extends OneSequenceGestureRecognizer with _Tap
12651271
12661272 void _resetTaps () {
12671273 _sentTapDown = false ;
1274+ _wonArenaForPrimaryPointer = false ;
12681275 _primaryPointer = null ;
12691276 }
12701277
0 commit comments