@@ -9,7 +9,6 @@ export default class GestureHandlerOrchestrator {
9
9
10
10
private gestureHandlers : GestureHandler [ ] = [ ] ;
11
11
private awaitingHandlers : GestureHandler [ ] = [ ] ;
12
- private handlersToCancel : GestureHandler [ ] = [ ] ;
13
12
14
13
private handlingChangeSemaphore = 0 ;
15
14
private activationIndex = 0 ;
@@ -34,7 +33,6 @@ export default class GestureHandlerOrchestrator {
34
33
public removeHandlerFromOrchestrator ( handler : GestureHandler ) : void {
35
34
this . gestureHandlers . splice ( this . gestureHandlers . indexOf ( handler ) , 1 ) ;
36
35
this . awaitingHandlers . splice ( this . awaitingHandlers . indexOf ( handler ) , 1 ) ;
37
- this . handlersToCancel . splice ( this . handlersToCancel . indexOf ( handler ) , 1 ) ;
38
36
}
39
37
40
38
private cleanupFinishedHandlers ( ) : void {
@@ -177,17 +175,12 @@ export default class GestureHandlerOrchestrator {
177
175
handler . setShouldResetProgress ( true ) ;
178
176
handler . setActivationIndex ( this . activationIndex ++ ) ;
179
177
180
- this . gestureHandlers . forEach ( ( otherHandler ) => {
181
- // Order of arguments is correct - we check whether current handler should cancel existing handlers
182
-
183
- if ( this . shouldHandlerBeCancelledBy ( otherHandler , handler ) ) {
184
- this . handlersToCancel . push ( otherHandler ) ;
178
+ for ( let i = this . gestureHandlers . length - 1 ; i >= 0 ; -- i ) {
179
+ if ( this . shouldHandlerBeCancelledBy ( this . gestureHandlers [ i ] , handler ) ) {
180
+ this . gestureHandlers [ i ] . cancel ( ) ;
185
181
}
186
- } ) ;
187
-
188
- for ( let i = this . handlersToCancel . length - 1 ; i >= 0 ; -- i ) {
189
- this . handlersToCancel [ i ] ?. cancel ( ) ;
190
182
}
183
+
191
184
this . awaitingHandlers . forEach ( ( otherHandler ) => {
192
185
if ( this . shouldHandlerBeCancelledBy ( otherHandler , handler ) ) {
193
186
otherHandler ?. cancel ( ) ;
@@ -212,8 +205,6 @@ export default class GestureHandlerOrchestrator {
212
205
}
213
206
}
214
207
}
215
-
216
- this . handlersToCancel = [ ] ;
217
208
}
218
209
219
210
private addAwaitingHandler ( handler : GestureHandler ) : void {
0 commit comments