From 9a4de512817e6db2c0feed5f764af512fd7291b6 Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Wed, 1 Mar 2023 13:29:42 -0800 Subject: [PATCH] Center map for tracking modes. --- Meshtastic/Views/Map/Custom/MapViewSwiftUI.swift | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Meshtastic/Views/Map/Custom/MapViewSwiftUI.swift b/Meshtastic/Views/Map/Custom/MapViewSwiftUI.swift index c5efd9fb..83287947 100644 --- a/Meshtastic/Views/Map/Custom/MapViewSwiftUI.swift +++ b/Meshtastic/Views/Map/Custom/MapViewSwiftUI.swift @@ -40,6 +40,10 @@ struct MapViewSwiftUI: UIViewRepresentable { mapView.addAnnotations(waypoints) mapView.setUserTrackingMode(UserTrackingModes(rawValue: userTrackingModeId )?.MKUserTrackingModeValue() ?? MKUserTrackingMode.none, animated: true) if UserTrackingModes(rawValue: userTrackingModeId) != UserTrackingModes.none { + let span = MKCoordinateSpan(latitudeDelta: 0.003, longitudeDelta: 0.003) + let center = LocationHelper.currentLocation + let region = MKCoordinateRegion(center: center, span: span) + mapView.setRegion(region, animated: true) mapView.showsUserLocation = true } else { mapView.showsUserLocation = false