mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
Tidy up some location things
This commit is contained in:
parent
ca4354d853
commit
f9cf71ad4e
11 changed files with 109 additions and 93 deletions
|
|
@ -39,7 +39,7 @@ struct MapViewSwiftUI: UIViewRepresentable {
|
|||
.filter { $0.latest == true }
|
||||
.sorted { $0.nodePosition?.num ?? 0 > $1.nodePosition?.num ?? -1 }
|
||||
let span = MKCoordinateSpan(latitudeDelta: 0.003, longitudeDelta: 0.003)
|
||||
let center = (latest.count > 0 && userTrackingMode == MKUserTrackingMode.none) ? latest[0].coordinate : LocationHelper.currentLocation
|
||||
let center = (latest.count > 0 && userTrackingMode == MKUserTrackingMode.none) ? latest[0].coordinate : LocationHelper.currentLocation.coordinate
|
||||
let region = MKCoordinateRegion(center: center, span: span)
|
||||
mapView.addAnnotations(showNodeHistory ? positions : latest)
|
||||
mapView.setRegion(region, animated: true)
|
||||
|
|
@ -263,7 +263,7 @@ struct MapViewSwiftUI: UIViewRepresentable {
|
|||
annotationView.glyphImage = UIImage(systemName: "flipphone")
|
||||
}
|
||||
if LocationHelper.currentLocation.distance(from: LocationHelper.DefaultLocation) > 0.0 {
|
||||
let metersAway = positionAnnotation.coordinate.distance(from: LocationHelper.currentLocation)
|
||||
let metersAway = positionAnnotation.coordinate.distance(from: LocationHelper.currentLocation.coordinate)
|
||||
subtitle.text! += NSLocalizedString("distance", comment: "") + ": \(distanceFormatter.string(fromDistance: Double(metersAway))) \n"
|
||||
}
|
||||
subtitle.text! += positionAnnotation.time?.formatted() ?? "Unknown \n"
|
||||
|
|
@ -296,7 +296,7 @@ struct MapViewSwiftUI: UIViewRepresentable {
|
|||
subtitle.text = ""
|
||||
}
|
||||
if LocationHelper.currentLocation.distance(from: LocationHelper.DefaultLocation) > 0.0 {
|
||||
let metersAway = waypointAnnotation.coordinate.distance(from: LocationHelper.currentLocation)
|
||||
let metersAway = waypointAnnotation.coordinate.distance(from: LocationHelper.currentLocation.coordinate)
|
||||
let distanceFormatter = MKDistanceFormatter()
|
||||
subtitle.text! += NSLocalizedString("distance", comment: "") + ": \(distanceFormatter.string(fromDistance: Double(metersAway))) \n"
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue