mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
I don't know if there is an issue for this, but without the fix it looks like (in particular see the end of the video) https://github.com/user-attachments/assets/0c25ffdf-1fc0-4eb2-a18e-f5b369b266d3 and with the fix it looks like https://github.com/user-attachments/assets/ade37009-a40b-4d1e-be22-b5ca5adfe246 Basically, we were using the value passed in by the engine in `onDisplayPlatformView(2)` to try to calculate the offset for this touch. However, we aren't guaranteed a call to `onDisplayPlatformView` for each call to `FlutterMutatorView.onTouchEvent`, and in practice we don't normally get them lined up like that, so the value is stale. Also, the touches are frequently changing by sub pixel values, but the values passed to `onDisplayPlatformView` are received as ints (we could maybe fix this, if it matters elsewhere). So this is fragile, comparing whole pixel to sub pixel, and also uses stale values. We can instead just ask android where the view is, I believe (this is what the PR does, and it works AFAICT). I don't know how to test this. --------- Co-authored-by: Gray Mackall <mackall@google.com>