From 738bb175510c60de9ec5ccbdccdb6867f678f9b4 Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Fri, 24 Mar 2023 23:56:31 -0700 Subject: [PATCH] Show all annotations when there is more than one node --- Meshtastic/Views/Map/Custom/MapViewSwiftUI.swift | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Meshtastic/Views/Map/Custom/MapViewSwiftUI.swift b/Meshtastic/Views/Map/Custom/MapViewSwiftUI.swift index ed4a8695..5833d35e 100644 --- a/Meshtastic/Views/Map/Custom/MapViewSwiftUI.swift +++ b/Meshtastic/Views/Map/Custom/MapViewSwiftUI.swift @@ -47,7 +47,11 @@ struct MapViewSwiftUI: UIViewRepresentable { // Set user (phone gps) tracking options mapView.setUserTrackingMode(userTrackingMode, animated: true) if userTrackingMode == MKUserTrackingMode.none { - mapView.fitAllAnnotations() + if latest.count == 1 { + mapView.fit(annotations:showNodeHistory ? positions : latest, andShow: false) + } else { + mapView.fitAllAnnotations() + } mapView.showsUserLocation = false } else { mapView.showsUserLocation = true @@ -151,8 +155,8 @@ struct MapViewSwiftUI: UIViewRepresentable { mapView.showsUserLocation = false mapView.addAnnotations(showNodeHistory ? positions : latest) if recenter { - if showRouteLines || showNodeHistory { - mapView.fit(annotations: showNodeHistory ? positions : latest, andShow: false) + if latest.count == 1 { + mapView.fit(annotations:showNodeHistory ? positions : latest, andShow: false) } else { mapView.fitAllAnnotations() }