From 7ae806650cfd305add37e7597c050991c7d696ab Mon Sep 17 00:00:00 2001 From: chenfufeng Date: Thu, 1 Jun 2023 20:40:24 +0800 Subject: [PATCH] =?UTF-8?q?[3.2.0][Opt]=E5=85=A8=E8=A7=88=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F=E4=BC=98=E5=8C=96=E8=AE=A1=E7=AE=97=E8=BD=A6=E5=B7=B2?= =?UTF-8?q?=E8=B5=B0=E8=BF=87=E8=BD=A8=E8=BF=B9=E7=9A=84=E7=B4=A2=E5=BC=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mogo/eagle/core/function/smp/MarkerDrawerManager.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/smp/MarkerDrawerManager.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/smp/MarkerDrawerManager.kt index ff77607edf..595ea91c96 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/smp/MarkerDrawerManager.kt +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/smp/MarkerDrawerManager.kt @@ -136,7 +136,8 @@ object MarkerDrawerManager { var baseDiffDis = CoordinateUtils.calculateLineDistance( realLon, realLat, baseLatLng.longitude, baseLatLng.latitude ) // lon,lat, prelon, prelat - for (i in 1 until routePoints.size) { + val size = routePoints.size + for (i in 1 until size) { val latLng = routePoints[i] // 深拷贝数据用于高德地图上轨迹线的绘制 newPoints.add(LatLng(latLng.latitude, latLng.longitude)) @@ -160,7 +161,9 @@ object MarkerDrawerManager { } Log.d("MarkerDrawerManager", "当次计算已走过的点的索引为:$currentIndex,存储的上次索引为:$lastArrivedIndex") if (currentIndex < lastArrivedIndex) { - currentIndex = lastArrivedIndex + if (lastArrivedIndex < size) { + currentIndex = lastArrivedIndex + } } else { lastArrivedIndex = currentIndex }