Position of layers in PointAnnotationManager and Cluster code does not affect the order on the screen
Environment
- Xcode version: 15.0.0
- iOS version: 17.0(simulator), 17.4.1(real device)
- Devices affected: all
- Maps SDK Version: 11.3.0
Observed behavior and steps to reproduce
The order in which the PointAnnotationManager layers are set has no effect on their display on the screen. What matters is the order in which they are added to the MapBox. Cluster from one PointAnnotationManager is always below another PointAnnotationManager. Layers ids are pointed on screenshots.
PointManager is one PointAnnotationManager
mapbox-iOS-cluster-circle-layer-manager-PointManager and mapbox-iOS-cluster-text-layer-manager-PointManager are cluster layers from PointManager
UserPinAnnotation is another PointAnnotationManager without cluster options.
mapView.mapboxMap.allLayerIdentifiers output:
▿ 4 elements
▿ 0 : LayerInfo
- id : "UserPinAnnotation"
▿ type : LayerType
- rawValue : "symbol"
▿ 1 : LayerInfo
- id : "PointManager"
▿ type : LayerType
- rawValue : "symbol"
▿ 2 : LayerInfo
- id : "mapbox-iOS-cluster-circle-layer-manager-PointManager"
▿ type : LayerType
- rawValue : "circle"
▿ 3 : LayerInfo
- id : "mapbox-iOS-cluster-text-layer-manager-PointManager"
▿ type : LayerType
- rawValue : "symbol"
-
Expected behavior
Cluster layers should be above UserPinAnnotation on the screen
This worked for me to gain control of z-index for layers. Call moveLayer on the onMapLoaded event.
proxy.map?.style.moveLayer(withId: "puck", to: .below("country-label"))
@skg54 In my scenerio I can't use that when I have onMapLoaded event, before I added it later.
I create my layer with makePointAnnotationManager with layer position.
For test I added scenario when I moved this layer after mapLoaded and it doesn't work either