Open schnfld opened 6 years ago
The clusterPosition
is causing the overlap. If you set clusterPosition
to .center
, it should fix your issue.
manager.clusterPosition = .nearCenter
manager.clusterPosition = .center
Thanks for the quick reply! This seemed to fix the overlapping but now the cluster is moving continuously to other positions when zooming, which could confuse the user. Also, it's clustering the annotations in one cluster, then creates two out of it and goes back to one cluster.
By the way: How can I display the grid on the map for debugging purpose?
I would give some extra space for the cellSize to avoid it jumping when zooming. I'll add a debug view to see cellSize boundaries.
I tried it with 80, 100, 150 for the 50x50 view. It seems that when the cell gets bigger also the jumping gets more affected. Here an example with 150, its contounysly moving arround:
You are right. I'll look into why it jumps.
New Issue Checklist
Issue Description
I tried almost everything and don't know, why I am not getting this thing to work. So I added a custom annotation view, subclass of ClusterAnnotationView. Its size is 50x50. I added the Delegate method:
func cellSize(for zoomLevel: Double) -> Double { return 80 }
And this is my configuration:
clusteringManager.delegate = self clusteringManager.shouldDistributeAnnotationsOnSameCoordinate = true clusteringManager.minCountForClustering = 2 clusteringManager.shouldRemoveInvisibleAnnotations = true clusteringManager.clusterPosition = .average clusteringManager.maxZoomLevel = 15
But I still ending up with this overlapping:
Environment