Clean up latest pin details popover

This commit is contained in:
Garth Vander Houwen 2023-09-18 16:53:02 -07:00
parent 3a5f192ac1
commit 13451323bd
3 changed files with 19 additions and 11 deletions

View file

@ -42,7 +42,7 @@ struct NodeDetail: View {
Divider()
NavigationLink {
if #available (iOS 17, macOS 14, *) {
NodeMapSwiftUI(node: node)
NodeMapSwiftUI(node: node, showUserLocation: connectedNode?.num ?? 0 == node.num)
} else {
NodeMapControl(node: node)
}

View file

@ -15,6 +15,9 @@ import WeatherKit
struct NodeMapSwiftUI: View {
@Environment(\.managedObjectContext) var context
@EnvironmentObject var bleManager: BLEManager
/// Parameters
@ObservedObject var node: NodeInfoEntity
@State var showUserLocation: Bool = false
/// Map State
@Namespace var mapScope
@AppStorage("meshMapShowNodeHistory") private var showNodeHistory = false
@ -27,20 +30,16 @@ struct NodeMapSwiftUI: View {
@State private var scene: MKLookAroundScene?
@State private var isLookingAround = false
@State private var isEditingSettings = false
@State private var showUserLocation: Bool = false
@State private var showConvexHull = true
@State var selected: PositionEntity?
@State private var selected: PositionEntity?
@State private var showingPopover = false
/// Data
@ObservedObject var node: NodeInfoEntity
@FetchRequest(sortDescriptors: [NSSortDescriptor(key: "name", ascending: false)],
predicate: NSPredicate(
format: "expire == nil || expire >= %@", Date() as NSDate
), animation: .none)
private var waypoints: FetchedResults<WaypointEntity>
@State private var showingPopover = false
var body: some View {
let nodeColor = UIColor(hex: UInt32(node.num))
let positionArray = node.positions?.array as? [PositionEntity] ?? []

View file

@ -17,6 +17,7 @@ struct PositionPopover: View {
CircleText(text: position.nodePosition?.user?.shortName ?? "?", color: Color(UIColor(hex: UInt32(position.nodePosition?.user?.num ?? 0))))
Text(position.nodePosition?.user?.longName ?? "Unknown")
.font(.title3)
let degrees = Angle.degrees(Double(position.heading))
}
Divider()
VStack (alignment: .leading) {
@ -45,7 +46,6 @@ struct PositionPopover: View {
/// Altitude
Label {
Text("Altitude: \(distanceFormatter.string(fromDistance: Double(position.altitude)))")
// .font(.footnote)
.foregroundColor(.primary)
} icon: {
Image(systemName: "mountain.2.fill")
@ -58,7 +58,6 @@ struct PositionPopover: View {
if pf.contains(.Satsinview) {
Label {
Text("Sats in view: \(String(position.satsInView))")
// .font(.footnote)
.foregroundColor(.primary)
} icon: {
Image(systemName: "sparkles")
@ -71,7 +70,6 @@ struct PositionPopover: View {
if pf.contains(.SeqNo) {
Label {
Text("Sequence: \(String(position.seqNo))")
// .font(.footnote)
.foregroundColor(.primary)
} icon: {
Image(systemName: "number")
@ -82,7 +80,18 @@ struct PositionPopover: View {
}
/// Heading
// if pf.contains(.Heading) {
// Text("Heading: \(Int32(position.heading))")
// let degrees = Angle.degrees(Double(position.heading))
// Label {
// let heading = Measurement(value: degrees.degrees, unit: UnitAngle.degrees)
// Text("Heading: \(heading.formatted())")
// .foregroundColor(.primary)
// } icon: {
// Image(systemName: "location.north")
// .symbolRenderingMode(.hierarchical)
// .frame(width: 35)
// .rotationEffect(degrees)
// }
// .padding(.bottom, 5)
// }
/// Speed
if pf.contains(.Speed) {