@@ -161,32 +161,30 @@ private void DispatchTouchEvent(TouchEventType touchEventType, List<ReactPointer
161
161
var changedIndices = new JArray ( ) ;
162
162
changedIndices . Add ( JToken . FromObject ( pointerIndex ) ) ;
163
163
164
- var touchEvent = new TouchEvent ( touchEventType , touches , changedIndices ) ;
164
+ var coalescingKey = activePointers [ pointerIndex ] . PointerId ;
165
+
166
+ var touchEvent = new TouchEvent ( touchEventType , touches , changedIndices , coalescingKey ) ;
165
167
166
168
_view . GetReactContext ( )
167
169
. GetNativeModule < UIManagerModule > ( )
168
170
. EventDispatcher
169
171
. DispatchEvent ( touchEvent ) ;
170
172
}
171
173
172
- /// <summary>
173
- /// Simple touch event.
174
- /// </summary>
175
- /// <remarks>
176
- /// TODO: revisit how to capture active pointers and coalesce efficiently.
177
- /// </remarks>
178
174
class TouchEvent : Event
179
175
{
180
176
private readonly TouchEventType _touchEventType ;
181
177
private readonly JArray _touches ;
182
178
private readonly JArray _changedIndices ;
179
+ private readonly uint _coalescingKey ;
183
180
184
- public TouchEvent ( TouchEventType touchEventType , JArray touches , JArray changedIndices )
181
+ public TouchEvent ( TouchEventType touchEventType , JArray touches , JArray changedIndices , uint coalescingKey )
185
182
: base ( - 1 , TimeSpan . FromTicks ( Environment . TickCount ) )
186
183
{
187
184
_touchEventType = touchEventType ;
188
185
_touches = touches ;
189
186
_changedIndices = changedIndices ;
187
+ _coalescingKey = coalescingKey ;
190
188
}
191
189
192
190
public override string EventName
@@ -201,7 +199,18 @@ public override bool CanCoalesce
201
199
{
202
200
get
203
201
{
204
- return false ;
202
+ return _touchEventType == TouchEventType . Move ;
203
+ }
204
+ }
205
+
206
+ public override short CoalescingKey
207
+ {
208
+ get
209
+ {
210
+ unchecked
211
+ {
212
+ return ( short ) _coalescingKey ;
213
+ }
205
214
}
206
215
}
207
216
0 commit comments