diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/OverMapView.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/OverMapView.kt index ee41d68558..0dfd54bc27 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/OverMapView.kt +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/OverMapView.kt @@ -152,6 +152,8 @@ class OverMapView @JvmOverloads constructor( @Volatile private var allPoints: List? = null + // 暂存下已选择的站点,确定可见视角的包含范围 + private var sitePointsTmp: List? = null companion object { private const val TAG = "OverMapView" @@ -876,8 +878,15 @@ class OverMapView @JvmOverloads constructor( //圈定地图显示范围 //存放经纬度 val boundsBuilder = LatLngBounds.Builder() - for (i in linePointsLatLng.indices) { - boundsBuilder.include(linePointsLatLng[i]) + val sitePoints = sitePointsTmp + if (!sitePoints.isNullOrEmpty()) { + for (i in sitePoints.indices) { + boundsBuilder.include(sitePoints[i]) + } + } else { + for (i in linePointsLatLng.indices) { + boundsBuilder.include(linePointsLatLng[i]) + } } val currentLatLng = LatLng(mLocation!!.latitude, mLocation!!.longitude) boundsBuilder.include(currentLatLng) @@ -977,6 +986,7 @@ class OverMapView @JvmOverloads constructor( for (i in coordinates.indices) { boundsBuilder.include(coordinates[i]) } + sitePointsTmp = coordinates isOnlyCarLocation = false } else { if (linePointsLatLng != null && linePointsLatLng.size > 1) { @@ -1085,6 +1095,7 @@ class OverMapView @JvmOverloads constructor( } siteMarkerList = null } + sitePointsTmp = null } private fun getBitmap(count: Int): Bitmap {