mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
Merge pull request #912 from meshtastic/waypointform-drop-maps-pin
Clean up waypoint form
This commit is contained in:
commit
74f11b0255
2 changed files with 22 additions and 15 deletions
|
|
@ -4911,15 +4911,8 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"Coordinates: %@, %@" : {
|
||||
"localizations" : {
|
||||
"en" : {
|
||||
"stringUnit" : {
|
||||
"state" : "new",
|
||||
"value" : "Coordinates: %1$@, %2$@"
|
||||
}
|
||||
}
|
||||
}
|
||||
"Coordinates:" : {
|
||||
|
||||
},
|
||||
"copy" : {
|
||||
"localizations" : {
|
||||
|
|
@ -10934,6 +10927,9 @@
|
|||
},
|
||||
"Location" : {
|
||||
|
||||
},
|
||||
"Location:" : {
|
||||
|
||||
},
|
||||
"Location: %@" : {
|
||||
|
||||
|
|
|
|||
|
|
@ -28,6 +28,8 @@ struct WaypointForm: View {
|
|||
@State private var expire: Date = Date.now.addingTimeInterval(60 * 480) // 1 minute * 480 = 8 Hours
|
||||
@State private var locked: Bool = false
|
||||
@State private var lockedTo: Int64 = 0
|
||||
@State private var detents: Set<PresentationDetent> = [.medium, .fraction(0.85)]
|
||||
@State private var selectedDetent: PresentationDetent = .medium
|
||||
|
||||
var body: some View {
|
||||
NavigationStack {
|
||||
|
|
@ -39,9 +41,12 @@ struct WaypointForm: View {
|
|||
let distance = CLLocation(latitude: LocationHelper.currentLocation.latitude, longitude: LocationHelper.currentLocation.longitude).distance(from: CLLocation(latitude: waypoint.coordinate.latitude, longitude: waypoint.coordinate.longitude ))
|
||||
Section(header: Text("Coordinate") ) {
|
||||
HStack {
|
||||
Text("Location: \(String(format: "%.5f", waypoint.coordinate.latitude) + "," + String(format: "%.5f", waypoint.coordinate.longitude))")
|
||||
Text("Location:")
|
||||
.foregroundColor(.secondary)
|
||||
Text("\(String(format: "%.5f", waypoint.coordinate.latitude) + "," + String(format: "%.5f", waypoint.coordinate.longitude))")
|
||||
.textSelection(.enabled)
|
||||
.foregroundColor(Color.gray)
|
||||
.foregroundColor(.secondary)
|
||||
.font(.caption)
|
||||
}
|
||||
HStack {
|
||||
if waypoint.coordinate.latitude != 0 && waypoint.coordinate.longitude != 0 {
|
||||
|
|
@ -124,6 +129,7 @@ struct WaypointForm: View {
|
|||
.toggleStyle(SwitchToggleStyle(tint: .accentColor))
|
||||
}
|
||||
}
|
||||
.scrollDismissesKeyboard(.immediately)
|
||||
HStack {
|
||||
Button {
|
||||
/// Send a new or exiting waypoint
|
||||
|
|
@ -239,7 +245,7 @@ struct WaypointForm: View {
|
|||
} else {
|
||||
VStack {
|
||||
HStack {
|
||||
CircleText(text: String(UnicodeScalar(Int(waypoint.icon)) ?? "📍"), color: Color.orange, circleSize: 65)
|
||||
CircleText(text: String(UnicodeScalar(Int(waypoint.icon)) ?? "📍"), color: Color.orange, circleSize: 50)
|
||||
Spacer()
|
||||
Text(waypoint.name ?? "?")
|
||||
.font(.largeTitle)
|
||||
|
|
@ -250,6 +256,7 @@ struct WaypointForm: View {
|
|||
} else {
|
||||
Button {
|
||||
editMode = true
|
||||
selectedDetent = .fraction(0.85)
|
||||
} label: {
|
||||
Image(systemName: "square.and.pencil" )
|
||||
.font(.largeTitle)
|
||||
|
|
@ -274,9 +281,12 @@ struct WaypointForm: View {
|
|||
}
|
||||
/// Coordinate
|
||||
Label {
|
||||
Text("Coordinates: \(String(format: "%.6f", waypoint.coordinate.latitude)), \(String(format: "%.6f", waypoint.coordinate.longitude))")
|
||||
.textSelection(.enabled)
|
||||
Text("Coordinates:")
|
||||
.foregroundColor(.primary)
|
||||
Text("\(String(format: "%.6f", waypoint.coordinate.latitude)), \(String(format: "%.6f", waypoint.coordinate.longitude))")
|
||||
.textSelection(.enabled)
|
||||
.foregroundColor(.secondary)
|
||||
.font(.caption2)
|
||||
} icon: {
|
||||
Image(systemName: "mappin.circle")
|
||||
}
|
||||
|
|
@ -381,7 +391,8 @@ struct WaypointForm: View {
|
|||
longitude = waypoint.coordinate.longitude
|
||||
}
|
||||
}
|
||||
.presentationDetents([.fraction(0.75)])
|
||||
.presentationDetents(detents, selection: $selectedDetent)
|
||||
.presentationBackgroundInteraction(.enabled(upThrough: .fraction(0.85)))
|
||||
.presentationDragIndicator(.visible)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue