mapbox / mapbox/mapbox-maps-ios

Position of layers in PointAnnotationManager and Cluster code does not affect the order on the screen

Open
#2,180 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

auto-triaged bug :beetle:
Dominant language
Swift
Stars
601
Forks
196
PR merge metrics
No merged PRs in 30d

Description

## 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"
-
![mapbox_issue](https://github.com/mapbox/mapbox-maps-ios/assets/157034382/328ea751-0441-484b-9692-efd6a4682e05)

## Expected behavior

Cluster layers should be above `UserPinAnnotation` on the screen

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with PointAnnotationManager and its Cluster layer ordering, using the reported allLayerIdentifiers output to trace how UserPinAnnotation and the cluster layers are placed. Done means cluster layers render above UserPinAnnotation regardless of the order in which the managers are added to the map.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, swift
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.