Closed OrbitalTech closed 1 year ago
@OrbitalTech Hi, you are using View Annotations, which are SwiftUI views that are placed on top of the Map. The Puck is rendered inside the map (by metal), so view annotations are always appear on top of the Puck or any other map content.
If you want to place content inside the map, use layer annotations https://docs.mapbox.com/ios/maps/api/11.0.0-beta.6-docc/documentation/mapboxmaps/swiftui-user-guide/#Layer-Annotations
PS: onCameraChanged
in your code triggers on every draw call, it's not recommended update @State
on every value change, it may lead to high CPU usage, it's better to filter out the values, like
.onCameraChanged { camera in
showSomethingOnHighZoom = camera.cameraState.zoom > 20
}
Feel free to reopen this issue if my suggestion didn't help
Environment
Observed behavior and steps to reproduce
I am rebuilding an IOS Application with swiftUI to use the latest mapbox API, what i observed and i couldn't figure out is how do you order annotations so that the user puck will always be on the highest lever?
In the example down below you can see my user puck moving and when we see a view annotation our user puck goes under it which makes it invisible for that time.
The expected behavior is so that the user puck is always on top.
Here is the code for adding the map and annotations:
`@ViewBuilder private var content: some View {