mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
Clean up the rest of the add annotations logic
This commit is contained in:
parent
b22cbcbff3
commit
644b2ea908
1 changed files with 23 additions and 27 deletions
|
|
@ -206,38 +206,34 @@ struct MapViewSwiftUI: UIViewRepresentable {
|
|||
}
|
||||
}
|
||||
|
||||
//DispatchQueue.main.async {
|
||||
let annotationCount = waypoints.count + (showNodeHistory ? positions.count : latest.count)
|
||||
if annotationCount != mapView.annotations.count {
|
||||
print("Annotation Count: \(annotationCount) Map Annotations: \(mapView.annotations.count)")
|
||||
mapView.removeAnnotations(mapView.annotations)
|
||||
mapView.addAnnotations(waypoints)
|
||||
|
||||
}
|
||||
if userTrackingMode == MKUserTrackingMode.none {
|
||||
mapView.showsUserLocation = false
|
||||
|
||||
|
||||
|
||||
let annotationCount = waypoints.count + (showNodeHistory ? positions.count : latest.count)
|
||||
if annotationCount != mapView.annotations.count {
|
||||
print("Annotation Count: \(annotationCount) Map Annotations: \(mapView.annotations.count)")
|
||||
mapView.removeAnnotations(mapView.annotations)
|
||||
mapView.addAnnotations(waypoints)
|
||||
|
||||
}
|
||||
if userTrackingMode == MKUserTrackingMode.none {
|
||||
mapView.showsUserLocation = false
|
||||
|
||||
if UserDefaults.enableMapRecentering {
|
||||
|
||||
if UserDefaults.enableMapRecentering {
|
||||
if annotationCount != mapView.annotations.count {
|
||||
mapView.addAnnotations(showNodeHistory ? positions : latest)
|
||||
mapView.fitAllAnnotations()
|
||||
// if latest.count > 1 {
|
||||
// mapView.fitAllAnnotations()
|
||||
// } else {
|
||||
// mapView.fit(annotations:showNodeHistory ? positions : latest, andShow: false)
|
||||
// }
|
||||
}
|
||||
} else {
|
||||
// Centering Done by tracking mode
|
||||
mapView.addAnnotations(showNodeHistory ? positions : latest)
|
||||
mapView.showsUserLocation = true
|
||||
if latest.count > 1 {
|
||||
mapView.fitAllAnnotations()
|
||||
} else {
|
||||
mapView.fit(annotations:showNodeHistory ? positions : latest, andShow: false)
|
||||
}
|
||||
}
|
||||
mapView.setUserTrackingMode(userTrackingMode, animated: true)
|
||||
// }
|
||||
} else {
|
||||
// Centering Done by tracking mode
|
||||
if annotationCount != mapView.annotations.count {
|
||||
mapView.addAnnotations(showNodeHistory ? positions : latest)
|
||||
}
|
||||
mapView.showsUserLocation = true
|
||||
}
|
||||
mapView.setUserTrackingMode(userTrackingMode, animated: true)
|
||||
}
|
||||
|
||||
func makeCoordinator() -> MapCoordinator {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue