More cleanup for maps and waypoints

This commit is contained in:
Garth Vander Houwen 2023-01-14 13:22:28 -08:00
parent f1d70a4103
commit a6c4f0639e
4 changed files with 12 additions and 5 deletions

View file

@ -80,8 +80,10 @@ class LocationHelper: NSObject, ObservableObject {
super.init()
locationManager.delegate = self
locationManager.desiredAccuracy = kCLLocationAccuracyBest
locationManager.desiredAccuracy = kCLLocationAccuracyNearestTenMeters
locationManager.pausesLocationUpdatesAutomatically = true
locationManager.allowsBackgroundLocationUpdates = true
locationManager.activityType = .otherNavigation
locationManager.requestWhenInUseAuthorization()
locationManager.startUpdatingLocation()
}

View file

@ -166,7 +166,7 @@ struct MapViewSwiftUI: UIViewRepresentable {
}
annotationView.clusteringIdentifier = "waypointGroup"
annotationView.markerTintColor = UIColor(.green)
annotationView.markerTintColor = UIColor(.indigo)
annotationView.titleVisibility = .visible
return annotationView
default: return nil

View file

@ -45,8 +45,8 @@ struct NodeDetail: View {
let annotations = node.positions?.array as! [PositionEntity]
ZStack {
MapViewSwiftUI(onMarkerTap: { coord in
presentingWaypointForm = true
waypointCoordinate = coord
presentingWaypointForm = true
}, positions: annotations, waypoints: Array(waypoints), region: MKCoordinateRegion(center: nodeCoordinatePosition, span: MKCoordinateSpan(latitudeDelta: 0.005, longitudeDelta: 0.005)), mapViewType: mapType,
customMapOverlay: self.customMapOverlay,
overlays: self.overlays

View file

@ -51,9 +51,14 @@ struct NodeMap: View {
ZStack {
MapViewSwiftUI(onMarkerTap: { coord in
presentingWaypointForm = true
waypointCoordinate = coord
}, positions: Array(positions), waypoints: Array(waypoints), region: MKCoordinateRegion(center: LocationHelper.currentLocation, span: MKCoordinateSpan(latitudeDelta: 0.005, longitudeDelta: 0.005)), mapViewType: mapType,
if waypointCoordinate?.latitude ?? LocationHelper.DefaultLocation.latitude == LocationHelper.DefaultLocation.latitude {
presentingWaypointForm = false
} else {
presentingWaypointForm = true
}
}, positions: Array(positions), waypoints: Array(waypoints), region: MKCoordinateRegion(center: LocationHelper.currentLocation, span: MKCoordinateSpan(latitudeDelta: 0.01, longitudeDelta: 0.01)), mapViewType: mapType,
customMapOverlay: self.customMapOverlay,
overlays: self.overlays
)