Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AnnotationViews are overlapping #97

Open
4 tasks done
schnfld opened this issue Oct 19, 2018 · 5 comments
Open
4 tasks done

AnnotationViews are overlapping #97

schnfld opened this issue Oct 19, 2018 · 5 comments

Comments

@schnfld
Copy link

schnfld commented Oct 19, 2018

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:

img_0045

Environment

  • iOS Version: iOS 11, 12
  • Device(s): iPhone X, 8+, SE
@efremidze
Copy link
Owner

The clusterPosition is causing the overlap. If you set clusterPosition to .center, it should fix your issue.

manager.clusterPosition = .nearCenter
simulator screen shot - iphone 7 - 2018-10-19 at 12 44 08

manager.clusterPosition = .center
simulator screen shot - iphone 7 - 2018-10-19 at 12 46 58

@schnfld
Copy link
Author

schnfld commented Oct 19, 2018

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.

ezgif-3-191bbe867505

By the way: How can I display the grid on the map for debugging purpose?

@efremidze
Copy link
Owner

efremidze commented Oct 20, 2018

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.

@schnfld
Copy link
Author

schnfld commented Oct 20, 2018

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:

ezgif-3-9ab4119c1df2

@efremidze
Copy link
Owner

You are right. I'll look into why it jumps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants