mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
Prevent waypoint form from opening up with apple park as the location
This commit is contained in:
parent
b11ae85104
commit
5fd3215921
4 changed files with 19 additions and 10 deletions
|
|
@ -181,12 +181,12 @@ struct MapViewSwiftUI: UIViewRepresentable {
|
|||
let location = longPressRecognizer.location(in: self.parent.mapView)
|
||||
// Map Coordinate - CLLocationCoordinate2D
|
||||
let coordinate = self.parent.mapView.convert(location, toCoordinateFrom: self.parent.mapView)
|
||||
parent.onMarkerTap(coordinate)
|
||||
// Add annotation:
|
||||
let annotation = MKPointAnnotation()
|
||||
annotation.title = "Dropped Pin"
|
||||
annotation.coordinate = coordinate
|
||||
parent.mapView.addAnnotation(annotation)
|
||||
parent.onMarkerTap(coordinate)
|
||||
UINotificationFeedbackGenerator().notificationOccurred(.success)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,8 +11,9 @@ import CoreLocation
|
|||
struct WaypointFormView: View {
|
||||
|
||||
@EnvironmentObject var bleManager: BLEManager
|
||||
@State var coordinate: CLLocationCoordinate2D
|
||||
@Environment(\.dismiss) private var dismiss
|
||||
@State var coordinate: CLLocationCoordinate2D
|
||||
|
||||
@FocusState private var iconIsFocused: Bool
|
||||
@State private var id: Int32?
|
||||
@State private var name: String = ""
|
||||
|
|
|
|||
|
|
@ -46,7 +46,11 @@ struct NodeDetail: View {
|
|||
ZStack {
|
||||
MapViewSwiftUI(onMarkerTap: { coord in
|
||||
waypointCoordinate = coord
|
||||
presentingWaypointForm = true
|
||||
if waypointCoordinate == nil {
|
||||
presentingWaypointForm = false
|
||||
} else {
|
||||
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
|
||||
|
|
@ -379,9 +383,11 @@ struct NodeDetail: View {
|
|||
}
|
||||
.edgesIgnoringSafeArea([.leading, .trailing])
|
||||
.sheet(isPresented: $presentingWaypointForm ) {//, onDismiss: didDismissSheet) {
|
||||
WaypointFormView(coordinate: waypointCoordinate ?? LocationHelper.DefaultLocation)
|
||||
.presentationDetents([.medium, .large])
|
||||
.presentationDragIndicator(.automatic)
|
||||
if waypointCoordinate != nil {
|
||||
WaypointFormView(coordinate: waypointCoordinate!)
|
||||
.presentationDetents([.medium, .large])
|
||||
.presentationDragIndicator(.automatic)
|
||||
}
|
||||
}
|
||||
.navigationBarTitle(String(node.user?.longName ?? NSLocalizedString("unknown", comment: "")), displayMode: .inline)
|
||||
.navigationBarItems(trailing:
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ struct NodeMap: View {
|
|||
|
||||
MapViewSwiftUI(onMarkerTap: { coord in
|
||||
waypointCoordinate = coord
|
||||
if waypointCoordinate?.latitude ?? LocationHelper.DefaultLocation.latitude == LocationHelper.DefaultLocation.latitude {
|
||||
if waypointCoordinate == nil {
|
||||
presentingWaypointForm = false
|
||||
} else {
|
||||
presentingWaypointForm = true
|
||||
|
|
@ -79,9 +79,11 @@ struct NodeMap: View {
|
|||
.ignoresSafeArea(.all, edges: [.top, .leading, .trailing])
|
||||
.frame(maxHeight: .infinity)
|
||||
.sheet(isPresented: $presentingWaypointForm ) {//, onDismiss: didDismissSheet) {
|
||||
WaypointFormView(coordinate: waypointCoordinate ?? LocationHelper.DefaultLocation)
|
||||
.presentationDetents([.medium, .large])
|
||||
.presentationDragIndicator(.automatic)
|
||||
if waypointCoordinate != nil {
|
||||
WaypointFormView(coordinate: waypointCoordinate!)
|
||||
.presentationDetents([.medium, .large])
|
||||
.presentationDragIndicator(.automatic)
|
||||
}
|
||||
}
|
||||
}
|
||||
.navigationBarItems(leading:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue