mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Dispatch platform view touch events to the presentation (#17792)
This commit is contained in:
parent
204adaf268
commit
f13031b026
@ -216,7 +216,6 @@ public class PlatformViewsController implements PlatformViewsAccessibilityDelega
|
||||
throw new IllegalStateException(
|
||||
"Sending touch to an unknown view with id: " + touch.viewId);
|
||||
}
|
||||
View view = vdControllers.get(touch.viewId).getView();
|
||||
|
||||
MotionEvent event =
|
||||
MotionEvent.obtain(
|
||||
@ -235,7 +234,7 @@ public class PlatformViewsController implements PlatformViewsAccessibilityDelega
|
||||
touch.source,
|
||||
touch.flags);
|
||||
|
||||
view.dispatchTouchEvent(event);
|
||||
vdControllers.get(touch.viewId).dispatchTouchEvent(event);
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
|
||||
|
||||
@ -11,6 +11,7 @@ import android.content.Context;
|
||||
import android.hardware.display.DisplayManager;
|
||||
import android.hardware.display.VirtualDisplay;
|
||||
import android.os.Build;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.Surface;
|
||||
import android.view.View;
|
||||
import android.view.ViewTreeObserver;
|
||||
@ -201,6 +202,12 @@ class VirtualDisplayController {
|
||||
return platformView.getView();
|
||||
}
|
||||
|
||||
/** Dispatches a motion event to the presentation for this controller. */
|
||||
public void dispatchTouchEvent(MotionEvent event) {
|
||||
if (presentation == null) return;
|
||||
presentation.dispatchTouchEvent(event);
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
|
||||
static class OneTimeOnDrawListener implements ViewTreeObserver.OnDrawListener {
|
||||
static void schedule(View view, Runnable runnable) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user