@@ -309,19 +309,38 @@ private MotionEvent toMotionEvent(float density, PlatformViewsChannel.PlatformVi
309
309
MotionEventTracker .MotionEventId motionEventId =
310
310
MotionEventTracker .MotionEventId .from (touch .motionEventId );
311
311
MotionEvent trackedEvent = motionEventTracker .pop (motionEventId );
312
- if (trackedEvent != null ) {
313
- return trackedEvent ;
314
- }
315
312
316
- // TODO (kaushikiska) : warn that we are potentially using an untracked
317
- // event in the platform views.
313
+ // Pointer coordinates in the tracked events are global to FlutterView
314
+ // framework converts them to be local to a widget, given that
315
+ // motion events operate on local coords, we need to replace these in the tracked
316
+ // event with their local counterparts.
318
317
PointerProperties [] pointerProperties =
319
318
parsePointerPropertiesList (touch .rawPointerPropertiesList )
320
319
.toArray (new PointerProperties [touch .pointerCount ]);
321
320
PointerCoords [] pointerCoords =
322
321
parsePointerCoordsList (touch .rawPointerCoords , density )
323
322
.toArray (new PointerCoords [touch .pointerCount ]);
324
323
324
+ if (trackedEvent != null ) {
325
+ return MotionEvent .obtain (
326
+ trackedEvent .getDownTime (),
327
+ trackedEvent .getEventTime (),
328
+ trackedEvent .getAction (),
329
+ touch .pointerCount ,
330
+ pointerProperties ,
331
+ pointerCoords ,
332
+ trackedEvent .getMetaState (),
333
+ trackedEvent .getButtonState (),
334
+ trackedEvent .getXPrecision (),
335
+ trackedEvent .getYPrecision (),
336
+ trackedEvent .getDeviceId (),
337
+ trackedEvent .getEdgeFlags (),
338
+ trackedEvent .getSource (),
339
+ trackedEvent .getFlags ());
340
+ }
341
+
342
+ // TODO (kaushikiska) : warn that we are potentially using an untracked
343
+ // event in the platform views.
325
344
return MotionEvent .obtain (
326
345
touch .downTime .longValue (),
327
346
touch .eventTime .longValue (),
0 commit comments