Explorar el Código

fix:优化地图

“HeShaoZe” hace 6 meses
padre
commit
0f2d11ed7b

+ 1 - 3
plugins/map_amap_ios/ios/Classes/MapAmapContentView/MapAmapThemeControl.swift

@@ -109,12 +109,10 @@ class MapAmapThemeControl: UIViewController {
         viewModel.$polylines
             .receive(on: DispatchQueue.main)
             .sink { [weak self] polylines in
-                
-                
+                self!.autonaviMap.removeOverlays(self!.autonaviMap.overlays)
                 guard let self, !polylines.isEmpty else { return }
                 // 清除旧覆盖物
                 self.autonaviMap.removeOverlays(self.autonaviMap.overlays)
-                
                 var polyinesList = [MAPolyline]();
                 for polyline in polylines {
                     let polylineItem : MyMAPolyline = MyMAPolyline(coordinates: &polyline.points, count: UInt(polyline.points.count))

+ 1 - 0
plugins/map_amap_ios/ios/Classes/ViewAndDataExchange/MapAmapViewAndDataExchange.swift

@@ -71,6 +71,7 @@ class MapAmapViewAndDataExchange: NSObject, ObservableObject, MapCapability {
     // 处理地图清除Marker
     func handleMapClearMarkers(result: @escaping FlutterResult) {
         markers = []
+        polylines = []
         result(nil)
     }