mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
Merge pull request #21 from garthvh/mesh-map-default-bounding-box
Check for a valid mesh region before jumping to it
This commit is contained in:
commit
553513a697
1 changed files with 6 additions and 0 deletions
|
|
@ -69,6 +69,12 @@ struct MapView: UIViewRepresentable {
|
|||
maxLon = max(maxLon, annotation.coordinate.longitude)
|
||||
}
|
||||
}
|
||||
|
||||
//check if the mesh region looks sensible before we move to it. Otherwise we won't move the map (leave it at the current location)
|
||||
if maxLat < minLat || (maxLat-minLat) > 5 || maxLon < minLon || (maxLon-minLon) > 5 {
|
||||
return
|
||||
}
|
||||
|
||||
let centerCoord = CLLocationCoordinate2D(latitude: (minLat+maxLat)/2, longitude: (minLon+maxLon)/2)
|
||||
|
||||
let span = MKCoordinateSpan(latitudeDelta: (maxLat-minLat)*1.5, longitudeDelta: (maxLon-minLon)*1.5)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue