[6.1.0][Fix]解决全览地图视角切换的问题

This commit is contained in:
chenfufeng
2023-10-09 11:57:25 +08:00
parent 25418d4c47
commit 4f88d65a63

View File

@@ -152,6 +152,8 @@ class OverMapView @JvmOverloads constructor(
@Volatile
private var allPoints: List<LatLng>? = null
// 暂存下已选择的站点,确定可见视角的包含范围
private var sitePointsTmp: List<LatLng>? = 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 {