mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
Move the map buttons to match the default compass
This commit is contained in:
parent
644b2ea908
commit
4f28da3240
2 changed files with 9 additions and 29 deletions
|
|
@ -45,7 +45,7 @@ struct MapButtons: View {
|
|||
.background(Color(UIColor.systemBackground))
|
||||
.cornerRadius(8)
|
||||
.shadow(radius: 1)
|
||||
.offset(y: 25)
|
||||
.offset(x: 2, y: self.tracking == .followWithHeading ? 90 : 25)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -78,35 +78,15 @@ struct MapViewSwiftUI: UIViewRepresentable {
|
|||
mapView.showsPitchControl = true
|
||||
#else
|
||||
#if os(iOS)
|
||||
|
||||
// Hide the default compass that only appears when you are not going north and instead always show the compass in the bottom right corner of the map
|
||||
mapView.showsCompass = false
|
||||
let compassButton = MKCompassButton(mapView: mapView) // Make a new compass
|
||||
compassButton.compassVisibility = .visible // Make it visible
|
||||
mapView.addSubview(compassButton) // Add it to the view
|
||||
compassButton.translatesAutoresizingMaskIntoConstraints = false
|
||||
compassButton.trailingAnchor.constraint(equalTo: mapView.trailingAnchor, constant: -5).isActive = true
|
||||
compassButton.bottomAnchor.constraint(equalTo: mapView.bottomAnchor, constant: -25).isActive = true
|
||||
|
||||
|
||||
// Hide the default compass that only appears when you are not going north and instead always show the compass
|
||||
// mapView.showsCompass = false
|
||||
// let compass = MKCompassButton(mapView: mapView)
|
||||
// compass.compassVisibility = .visible
|
||||
// If we are a details map show the compass in the bottom left
|
||||
//if latest.count == 1 {
|
||||
// If we are a details map show the compass in the bottom left
|
||||
// Add it to the view
|
||||
// compass.translatesAutoresizingMaskIntoConstraints = false
|
||||
// compass.trailingAnchor.constraint(equalTo: mapView.trailingAnchor, constant: -5).isActive = true
|
||||
// compass.bottomAnchor.constraint(equalTo: mapView.bottomAnchor, constant: -25).isActive = true
|
||||
//} else {
|
||||
//compass.frame = CGRect(origin: CGPoint(x: UIScreen.main.bounds.width - 53, y: 135), size: CGSize(width: 45, height: 45))
|
||||
//mapView.addSubview(compass)
|
||||
//}
|
||||
//mapView.addSubview(compass)
|
||||
// Hide the default compass that only appears when you are not going north and instead always show the compass in the bottom right corner
|
||||
mapView.showsCompass = true
|
||||
// let compassButton = MKCompassButton(mapView: mapView)
|
||||
// compassButton.compassVisibility = .adaptive
|
||||
// mapView.addSubview(compassButton)
|
||||
// compassButton.translatesAutoresizingMaskIntoConstraints = false
|
||||
// compassButton.trailingAnchor.constraint(equalTo: mapView.trailingAnchor, constant: -5).isActive = true
|
||||
// compassButton.bottomAnchor.constraint(equalTo: mapView.bottomAnchor, constant: -25).isActive = true
|
||||
#endif
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue