diff options
-rw-r--r-- | iosApp/iosApp/Map/MapView.swift | 12 | ||||
-rw-r--r-- | shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/infrastructure/ApiClient.kt | 2 |
2 files changed, 10 insertions, 4 deletions
diff --git a/iosApp/iosApp/Map/MapView.swift b/iosApp/iosApp/Map/MapView.swift index 989f17a..2c86c3b 100644 --- a/iosApp/iosApp/Map/MapView.swift +++ b/iosApp/iosApp/Map/MapView.swift @@ -28,8 +28,11 @@ struct MapView: UIViewControllerRepresentable { @Binding var selected: Marker? var markerCallback: MarkerCallback? + var shouldCenter = true + class Coordinator { var shouldCenter: Bool = true + var oldMarkers: [Marker] = [] } func makeCoordinator() -> Coordinator { @@ -48,10 +51,13 @@ struct MapView: UIViewControllerRepresentable { uiViewController.setMapLayer(layer) // MARK: - Set markers - uiViewController.display(markers: markers, - isReport: false, - center: context.coordinator.shouldCenter) + if context.coordinator.oldMarkers != markers { + uiViewController.display(markers: markers, + isReport: false, + center: context.coordinator.shouldCenter) + } context.coordinator.shouldCenter = false + context.coordinator.oldMarkers = markers // MARK: - Center selected marker if let selected = selected { diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/infrastructure/ApiClient.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/infrastructure/ApiClient.kt index 78bcf3b..e9865e8 100644 --- a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/infrastructure/ApiClient.kt +++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/infrastructure/ApiClient.kt @@ -59,7 +59,7 @@ open class ApiClient( } install(Logging) { logger = Logger.DEFAULT - level = LogLevel.ALL + level = LogLevel.INFO } } |