aboutsummaryrefslogtreecommitdiff
path: root/iosApp
diff options
context:
space:
mode:
Diffstat (limited to 'iosApp')
-rw-r--r--iosApp/iosApp/Map/MapView.swift12
1 files changed, 9 insertions, 3 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 {