[6.5.0][视角切换] 优化高精地图控件手势禁用和开启逻辑

This commit is contained in:
renwj
2024-07-23 15:39:18 +08:00
parent 186f8b46b5
commit 3c36b6e3bb
6 changed files with 27 additions and 30 deletions

View File

@@ -139,6 +139,8 @@ class MapView(context: Context, private val mMapStyleParams: IMapStyleParams, pr
private var waitTime = 5000L
private var isAutoLockCar = true
private var isAllGestureEnabled = true
// 协程
private val mScope: CoroutineScope = CoroutineScope(SupervisorJob() + Dispatchers.Default)
// 耗时专用协程
@@ -336,6 +338,9 @@ class MapView(context: Context, private val mMapStyleParams: IMapStyleParams, pr
var lonlat: LonLat? = null
override fun onTouchEvent(ev: MotionEvent): Boolean {
if (!isAllGestureEnabled) {
return mGestureDetector.onTouchEvent(ev)
}
if (ev.action == MotionEvent.ACTION_MOVE && mDragMarker != null) {
mDragMarker?.let {
if(DEBUG){
@@ -993,6 +998,9 @@ class MapView(context: Context, private val mMapStyleParams: IMapStyleParams, pr
if (DEBUG && mShowTouchInfo) {
Log.i(TAG, "touchop--mGestureDetector--onFling:e1:${e1.x},${e1.y},e2:${e2.x},${e2.y},${velocityX},${velocityY}")
}
if (!isAllGestureEnabled) {
return false
}
if (e1.pointerCount >= 2 || e2.pointerCount >= 2) {
return false
}
@@ -1040,6 +1048,10 @@ class MapView(context: Context, private val mMapStyleParams: IMapStyleParams, pr
if (DEBUG && mShowTouchInfo) {
Log.i(TAG, "touchop--mGestureDetector--onScroll:e1:${e1.pointerCount},${e1.x},${e1.y},,e2:${e2.pointerCount},${e2.x},${e2.y},$distanceX,$distanceY,time:${e2.eventTime}")
}
if (!isAllGestureEnabled) {
return false
}
if (e1.pointerCount >= 2 || e2.pointerCount >= 2) {
return false
}
@@ -1256,6 +1268,10 @@ class MapView(context: Context, private val mMapStyleParams: IMapStyleParams, pr
this.renderTimePer = renderTimePer
}
override fun setAllGestureEnabled(flag: Boolean) {
this.isAllGestureEnabled = flag
}
private fun renderDataCallback(data: String) {
// if(DEBUG){
// Log.d("renderDataCallback", "renderDataCallback:$data")