diff --git a/Meshtastic/Enums/AppSettingsEnums.swift b/Meshtastic/Enums/AppSettingsEnums.swift index d7001a62..e477ae1b 100644 --- a/Meshtastic/Enums/AppSettingsEnums.swift +++ b/Meshtastic/Enums/AppSettingsEnums.swift @@ -36,11 +36,10 @@ enum KeyboardType: Int, CaseIterable, Identifiable { } enum CenteringMode: Int, CaseIterable, Identifiable { - + case allAnnotations = 0 case allPositions = 1 - case phoneGps = 2 - + var id: Int { self.rawValue } var description: String { get { @@ -49,8 +48,6 @@ enum CenteringMode: Int, CaseIterable, Identifiable { return "All Annotations"// NSLocalizedString("default", comment: "Default Keyboard") case .allPositions: return "All Node Postions"// NSLocalizedString("ascii.capable", comment: "ASCII Capable Keyboard") - case .phoneGps: - return "Phone GPS"//NSLocalizedString("email.address", comment: "Email Address Keyboard") } } } diff --git a/Meshtastic/Views/Map/Custom/MapViewSwiftUI.swift b/Meshtastic/Views/Map/Custom/MapViewSwiftUI.swift index 9213126f..b491559a 100644 --- a/Meshtastic/Views/Map/Custom/MapViewSwiftUI.swift +++ b/Meshtastic/Views/Map/Custom/MapViewSwiftUI.swift @@ -40,18 +40,11 @@ struct MapViewSwiftUI: UIViewRepresentable { mapView.addAnnotations(waypoints) // Logic to manage the map centering options switch centeringMode { - case .allAnnotations: - mapView.addAnnotations(positions) - mapView.fitAllAnnotations() - case .allPositions: - mapView.fit(annotations: positions, andShow: true) - case .phoneGps: - - let span = MKCoordinateSpan(latitudeDelta: 0.003, longitudeDelta: 0.003) - let center = CLLocationCoordinate2D(latitude: LocationHelper.currentLocation.latitude, longitude: LocationHelper.currentLocation.longitude) - let region = MKCoordinateRegion(center: center, span: span) - mapView.setRegion(region, animated: true) - mapView.addAnnotations(positions) + case .allAnnotations: + mapView.addAnnotations(positions) + mapView.fitAllAnnotations() + case .allPositions: + mapView.fit(annotations: positions, andShow: true) } // Other MKMapView Settings @@ -121,31 +114,24 @@ struct MapViewSwiftUI: UIViewRepresentable { mapView.removeAnnotations(mapView.annotations) mapView.addAnnotations(waypoints) mapView.setUserTrackingMode(UserTrackingModes(rawValue: userTrackingModeId )?.MKUserTrackingModeValue() ?? MKUserTrackingMode.none, animated: true) + mapView.showsUserLocation = true } switch centeringMode { - case .allAnnotations: - if annotationCount != mapView.annotations.count { - mapView.addAnnotations(positions) - if recenter { - mapView.fitAllAnnotations() - } - } - case .allPositions: - if annotationCount != mapView.annotations.count { - if recenter { - mapView.fit(annotations: positions, andShow: true) - } else { - mapView.addAnnotations(positions) - } - } - case .phoneGps: - if annotationCount != mapView.annotations.count { - mapView.addAnnotations(positions) - } - mapView.showsUserLocation = true + case .allAnnotations: + if annotationCount != mapView.annotations.count { + mapView.addAnnotations(positions) if recenter { - mapView.centerCoordinate = LocationHelper.currentLocation + mapView.fitAllAnnotations() } + } + case .allPositions: + if annotationCount != mapView.annotations.count { + if recenter { + mapView.fit(annotations: positions, andShow: true) + } else { + mapView.addAnnotations(positions) + } + } } } }