From f05777919dd7589f7cc5168d18f0180b73f55a7c Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Sun, 21 Jan 2024 18:20:45 -0800 Subject: [PATCH] Show all nodes on the mesh map again --- Meshtastic/Views/Nodes/MeshMap.swift | 31 ++++++++++++++-------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/Meshtastic/Views/Nodes/MeshMap.swift b/Meshtastic/Views/Nodes/MeshMap.swift index 5831679a..dfed0c38 100644 --- a/Meshtastic/Views/Nodes/MeshMap.swift +++ b/Meshtastic/Views/Nodes/MeshMap.swift @@ -43,9 +43,9 @@ struct MeshMap: View { var delay: Double = 0 @State private var scale: CGFloat = 0.5 - + /// && time >= %@ @FetchRequest(sortDescriptors: [NSSortDescriptor(key: "time", ascending: true)], - predicate: NSPredicate(format: "nodePosition != nil && latest == true && time >= %@", Calendar.current.date(byAdding: .day, value: -7, to: Date())! as NSDate), animation: .none) + predicate: NSPredicate(format: "nodePosition != nil && latest == true", Calendar.current.date(byAdding: .day, value: -7, to: Date())! as NSDate), animation: .none) private var positions: FetchedResults @FetchRequest(sortDescriptors: [NSSortDescriptor(key: "name", ascending: false)], @@ -67,19 +67,6 @@ struct MeshMap: View { ZStack { MapReader { reader in Map(position: $position, bounds: MapCameraBounds(minimumDistance: 1, maximumDistance: .infinity), scope: mapScope) { - /// Waypoint Annotations - if waypoints.count > 0 && showWaypoints { - ForEach(Array(waypoints), id: \.id) { waypoint in - Annotation(waypoint.name ?? "?", coordinate: waypoint.coordinate) { - LazyVStack { - CircleText(text: String(UnicodeScalar(Int(waypoint.icon)) ?? "📍"), color: Color.orange, circleSize: 40) - .onTapGesture(perform: { location in - selectedWaypoint = (selectedWaypoint == waypoint ? nil : waypoint) - }) - } - } - } - } /// Convex Hull if showConvexHull { if lineCoords.count > 0 { @@ -209,6 +196,20 @@ struct MeshMap: View { } } } + + /// Waypoint Annotations + if waypoints.count > 0 && showWaypoints { + ForEach(Array(waypoints), id: \.id) { waypoint in + Annotation(waypoint.name ?? "?", coordinate: waypoint.coordinate) { + LazyVStack { + CircleText(text: String(UnicodeScalar(Int(waypoint.icon)) ?? "📍"), color: Color.orange, circleSize: 40) + .onTapGesture(perform: { location in + selectedWaypoint = (selectedWaypoint == waypoint ? nil : waypoint) + }) + } + } + } + } } .mapScope(mapScope) .mapStyle(mapStyle)