@@ -63,32 +63,23 @@ function initializeTapAndDoubleTapGestureListener() {
63
63
64
64
public onLongPress ( motionEvent : android . view . MotionEvent ) : void {
65
65
if ( this . _type & GestureTypes . longPress && this . _observer ?. callback ) {
66
- new DOMEvent ( 'longPress' ) . dispatchTo ( {
67
- target : this . _target ,
68
- data : _getLongPressArgs ( GestureTypes . longPress , this . _target , GestureStateTypes . began , motionEvent ) ,
69
- } ) ;
66
+ new DOMEvent ( 'longPress' ) . dispatchTo ( this . _target , _getLongPressArgs ( GestureTypes . longPress , this . _target , GestureStateTypes . began , motionEvent ) ) ;
70
67
}
71
68
}
72
69
73
70
private _handleSingleTap ( motionEvent : android . view . MotionEvent ) : void {
74
71
if ( this . _target . getGestureObservers ( GestureTypes . doubleTap ) . length ) {
75
72
this . _tapTimeoutId = timer . setTimeout ( ( ) => {
76
73
if ( this . _type & GestureTypes . tap && this . _observer ?. callback ) {
77
- new DOMEvent ( 'tap' ) . dispatchTo ( {
78
- target : this . _target ,
79
- data : _getTapArgs ( GestureTypes . tap , this . _target , motionEvent ) ,
80
- } ) ;
74
+ new DOMEvent ( 'tap' ) . dispatchTo ( this . _target , _getTapArgs ( GestureTypes . tap , this . _target , motionEvent ) ) ;
81
75
}
82
76
timer . clearTimeout ( this . _tapTimeoutId ) ;
83
77
} , TapAndDoubleTapGestureListenerImpl . DoubleTapTimeout ) ;
84
78
return ;
85
79
}
86
80
87
81
if ( this . _type & GestureTypes . tap && this . _observer ?. callback ) {
88
- new DOMEvent ( 'tap' ) . dispatchTo ( {
89
- target : this . _target ,
90
- data : _getTapArgs ( GestureTypes . tap , this . _target , motionEvent ) ,
91
- } ) ;
82
+ new DOMEvent ( 'tap' ) . dispatchTo ( this . _target , _getTapArgs ( GestureTypes . tap , this . _target , motionEvent ) ) ;
92
83
}
93
84
}
94
85
@@ -97,10 +88,7 @@ function initializeTapAndDoubleTapGestureListener() {
97
88
timer . clearTimeout ( this . _tapTimeoutId ) ;
98
89
}
99
90
if ( this . _type & GestureTypes . doubleTap && this . _observer ?. callback ) {
100
- new DOMEvent ( 'doubleTap' ) . dispatchTo ( {
101
- target : this . _target ,
102
- data : _getTapArgs ( GestureTypes . doubleTap , this . _target , motionEvent ) ,
103
- } ) ;
91
+ new DOMEvent ( 'doubleTap' ) . dispatchTo ( this . _target , _getTapArgs ( GestureTypes . doubleTap , this . _target , motionEvent ) ) ;
104
92
}
105
93
}
106
94
}
@@ -137,10 +125,7 @@ function initializePinchGestureListener() {
137
125
this . _scale = detector . getScaleFactor ( ) ;
138
126
139
127
if ( this . _observer ?. callback ) {
140
- new DOMEvent ( 'pinch' ) . dispatchTo ( {
141
- target : this . _target ,
142
- data : new PinchGestureEventData ( this . _target , detector , this . _scale , this . _target , GestureStateTypes . began ) ,
143
- } ) ;
128
+ new DOMEvent ( 'pinch' ) . dispatchTo ( this . _target , new PinchGestureEventData ( this . _target , detector , this . _scale , this . _target , GestureStateTypes . began ) ) ;
144
129
}
145
130
146
131
return true ;
@@ -150,10 +135,7 @@ function initializePinchGestureListener() {
150
135
this . _scale *= detector . getScaleFactor ( ) ;
151
136
152
137
if ( this . _observer ?. callback ) {
153
- new DOMEvent ( 'pinch' ) . dispatchTo ( {
154
- target : this . _target ,
155
- data : new PinchGestureEventData ( this . _target , detector , this . _scale , this . _target , GestureStateTypes . changed ) ,
156
- } ) ;
138
+ new DOMEvent ( 'pinch' ) . dispatchTo ( this . _target , new PinchGestureEventData ( this . _target , detector , this . _scale , this . _target , GestureStateTypes . changed ) ) ;
157
139
}
158
140
159
141
return true ;
@@ -163,10 +145,7 @@ function initializePinchGestureListener() {
163
145
this . _scale *= detector . getScaleFactor ( ) ;
164
146
165
147
if ( this . _observer ?. callback ) {
166
- new DOMEvent ( 'pinch' ) . dispatchTo ( {
167
- target : this . _target ,
168
- data : new PinchGestureEventData ( this . _target , detector , this . _scale , this . _target , GestureStateTypes . ended ) ,
169
- } ) ;
148
+ new DOMEvent ( 'pinch' ) . dispatchTo ( this . _target , new PinchGestureEventData ( this . _target , detector , this . _scale , this . _target , GestureStateTypes . ended ) ) ;
170
149
}
171
150
}
172
151
}
@@ -212,19 +191,13 @@ function initializeSwipeGestureListener() {
212
191
if ( Math . abs ( deltaX ) > SWIPE_THRESHOLD && Math . abs ( velocityX ) > SWIPE_VELOCITY_THRESHOLD ) {
213
192
if ( deltaX > 0 ) {
214
193
if ( this . _observer ?. callback ) {
215
- new DOMEvent ( 'swipe' ) . dispatchTo ( {
216
- target : this . _target ,
217
- data : _getSwipeArgs ( SwipeDirection . right , this . _target , initialEvent , currentEvent ) ,
218
- } ) ;
194
+ new DOMEvent ( 'swipe' ) . dispatchTo ( this . _target , _getSwipeArgs ( SwipeDirection . right , this . _target , initialEvent , currentEvent ) ) ;
219
195
}
220
196
221
197
result = true ;
222
198
} else {
223
199
if ( this . _observer ?. callback ) {
224
- new DOMEvent ( 'swipe' ) . dispatchTo ( {
225
- target : this . _target ,
226
- data : _getSwipeArgs ( SwipeDirection . left , this . _target , initialEvent , currentEvent ) ,
227
- } ) ;
200
+ new DOMEvent ( 'swipe' ) . dispatchTo ( this . _target , _getSwipeArgs ( SwipeDirection . left , this . _target , initialEvent , currentEvent ) ) ;
228
201
}
229
202
result = true ;
230
203
}
@@ -233,18 +206,12 @@ function initializeSwipeGestureListener() {
233
206
if ( Math . abs ( deltaY ) > SWIPE_THRESHOLD && Math . abs ( velocityY ) > SWIPE_VELOCITY_THRESHOLD ) {
234
207
if ( deltaY > 0 ) {
235
208
if ( this . _observer ?. callback ) {
236
- new DOMEvent ( 'swipe' ) . dispatchTo ( {
237
- target : this . _target ,
238
- data : _getSwipeArgs ( SwipeDirection . down , this . _target , initialEvent , currentEvent ) ,
239
- } ) ;
209
+ new DOMEvent ( 'swipe' ) . dispatchTo ( this . _target , _getSwipeArgs ( SwipeDirection . down , this . _target , initialEvent , currentEvent ) ) ;
240
210
}
241
211
result = true ;
242
212
} else {
243
213
if ( this . _observer ?. callback ) {
244
- new DOMEvent ( 'swipe' ) . dispatchTo ( {
245
- target : this . _target ,
246
- data : _getSwipeArgs ( SwipeDirection . up , this . _target , initialEvent , currentEvent ) ,
247
- } ) ;
214
+ new DOMEvent ( 'swipe' ) . dispatchTo ( this . _target , _getSwipeArgs ( SwipeDirection . up , this . _target , initialEvent , currentEvent ) ) ;
248
215
}
249
216
result = true ;
250
217
}
@@ -372,10 +339,7 @@ export class GesturesObserver extends GesturesObserverBase {
372
339
this . _eventData . prepare ( this . target , motionEvent ) ;
373
340
374
341
if ( this . callback ) {
375
- new DOMEvent ( 'touch' ) . dispatchTo ( {
376
- target : this . target ,
377
- data : this . _eventData ,
378
- } ) ;
342
+ new DOMEvent ( 'touch' ) . dispatchTo ( this . target , this . _eventData ) ;
379
343
}
380
344
}
381
345
@@ -504,10 +468,7 @@ class CustomPanGestureDetector {
504
468
private trackStop ( currentEvent : android . view . MotionEvent , cacheEvent : boolean ) {
505
469
if ( this . isTracking ) {
506
470
if ( this . observer ?. callback ) {
507
- new DOMEvent ( 'pan' ) . dispatchTo ( {
508
- target : this . target ,
509
- data : _getPanArgs ( this . deltaX , this . deltaY , this . target , GestureStateTypes . ended , null , currentEvent ) ,
510
- } ) ;
471
+ new DOMEvent ( 'pan' ) . dispatchTo ( this . target , _getPanArgs ( this . deltaX , this . deltaY , this . target , GestureStateTypes . ended , null , currentEvent ) ) ;
511
472
}
512
473
513
474
this . deltaX = undefined ;
@@ -529,10 +490,7 @@ class CustomPanGestureDetector {
529
490
this . isTracking = true ;
530
491
531
492
if ( this . observer ?. callback ) {
532
- new DOMEvent ( 'pan' ) . dispatchTo ( {
533
- target : this . target ,
534
- data : _getPanArgs ( 0 , 0 , this . target , GestureStateTypes . began , null , currentEvent ) ,
535
- } ) ;
493
+ new DOMEvent ( 'pan' ) . dispatchTo ( this . target , _getPanArgs ( 0 , 0 , this . target , GestureStateTypes . began , null , currentEvent ) ) ;
536
494
}
537
495
}
538
496
@@ -542,10 +500,7 @@ class CustomPanGestureDetector {
542
500
this . deltaY = current . y - this . initialY ;
543
501
544
502
if ( this . observer ?. callback ) {
545
- new DOMEvent ( 'pan' ) . dispatchTo ( {
546
- target : this . target ,
547
- data : _getPanArgs ( this . deltaX , this . deltaY , this . target , GestureStateTypes . changed , null , currentEvent ) ,
548
- } ) ;
503
+ new DOMEvent ( 'pan' ) . dispatchTo ( this . target , _getPanArgs ( this . deltaX , this . deltaY , this . target , GestureStateTypes . changed , null , currentEvent ) ) ;
549
504
}
550
505
}
551
506
@@ -665,10 +620,7 @@ class CustomRotateGestureDetector {
665
620
} ;
666
621
667
622
if ( this . observer ?. callback ) {
668
- new DOMEvent ( 'rotation' ) . dispatchTo ( {
669
- target : this . target ,
670
- data : args ,
671
- } ) ;
623
+ new DOMEvent ( 'rotation' ) . dispatchTo ( this . target , args ) ;
672
624
}
673
625
}
674
626
0 commit comments