Android 如何检查google地图是否仅通过用户手势移动(平移、倾斜、挤压…),而不是通过编程方式移动
医生说Android 如何检查google地图是否仅通过用户手势移动(平移、倾斜、挤压…),而不是通过编程方式移动,android,google-maps,flutter,dart,Android,Google Maps,Flutter,Dart,医生说 // Called when the camera starts moving. /// /// This can be initiated by the following: /// 1. Non-gesture animation initiated in response to user actions. /// For example: zoom buttons, my location button, or marker clicks. /// 2.
// Called when the camera starts moving.
///
/// This can be initiated by the following:
/// 1. Non-gesture animation initiated in response to user actions.
/// For example: zoom buttons, my location button, or marker clicks.
/// 2. Programmatically initiated animation.
/// 3. Camera motion initiated in response to user gestures on the map.
/// For example: pan, tilt, pinch to zoom, or rotate.
final VoidCallback onCameraMoveStarted;
如何检查地图是否仅通过用户手势移动(3)(平移、倾斜、收缩…)而非编程方式(1)和(2)无论如何,您可以一起跟踪和相机更新,并确定地图是否由于用户手势而移动。甚至像提议的那样:
返回吸收器指针(
是的,
孩子:谷歌地图(
mapType:mapType.normal,
initialCameraPosition:cameraPosition,
手势识别器:{
工厂(()=>scalegesturererecognizer()),
}
)
);
然后以编程方式处理所有这些问题,并决定如何处理地图。即使以编程方式移动相机,也会调用此函数
return AbsorbPointer(
absorbing: true,
child: GoogleMap(
mapType: MapType.normal,
initialCameraPosition: cameraPosition,
gestureRecognizers: {
Factory<OneSequenceGestureRecognizer>(() => ScaleGestureRecognizer()),
}
)
);