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

Strange behavior when zooming in and out #133

Open
maxencehenneron opened this issue Oct 12, 2016 · 14 comments
Open

Strange behavior when zooming in and out #133

maxencehenneron opened this issue Oct 12, 2016 · 14 comments
Labels

Comments

@maxencehenneron
Copy link

maxencehenneron commented Oct 12, 2016

Good afternoon, I'm currently building an app for my family and I'm concerned about a bug when zooming the map.

As you can see in this video: https://www.youtube.com/watch?v=vjbB0sEtHSQ, on the first second, I'm zooming the map and one photo - or annotation - is removed from the cluster and after zooming again, the photo is back into the cluster. We can see this happening as well when zooming out on second 13, the stack contains 18 pictures, and after zooming out, one picture is removed from the stack.

It makes it look like the clusters are completely random, is it something I missed?

Thank you,
Maxence Henneron.

@choefele
Copy link
Owner

Hi – did you implement both mapView:(MKMapView *)mapView viewForAnnotation: and mapClusterController:willReuseMapClusterAnnotation:? The former is called when the annotation view is created and the latter when the annotation view is reused. In both cases, you'll have to properly updated your annotation views.

Also, make sure you only add annotations to the cluster manager and never to the map view directly

@maxencehenneron
Copy link
Author

Yes, both of then are implemented. I also did this:

self.mapClusterController.cellSize = CGFloat(self.mapView.frame.width / 6)

To conform to "The actual cell size used for clustering will be adjusted so that the map's width is a multiple of the cell size. This avoids realignment of cells when panning across the 180th meridian."

This is also happening in the example, sometimes zooming on a stack makes the cluster bigger (it shouldn't, since we are zooming, we may except the stack to be smaller) and zooming out makes a cluster smaller, when notifications should be added. The grid shown when isDebugingEnabled = true also shows strange movements, it seems that the alignment is changing

@maxencehenneron
Copy link
Author

I made a new video about this issue: Please pay attention to the random grid movement, which sometimes sets different stacks:

https://www.youtube.com/watch?v=_3k_LN9C65M&feature=youtu.be

@choefele
Copy link
Owner

Hmm – have you compared this to the demo project in this repo? Does the sample in this repo show the same problem? Maybe you need to provide a sample project that reproduces this issue so I can debug the problem

@alexsteinerde
Copy link

Hello,
I have the same problem and would like to have a solution for this issue as well.

@maxencehenneron
Copy link
Author

maxencehenneron commented Oct 12, 2016

So I made an example project :

Please go to Ukraine and you should see two stacks of photos, zoom as much as possible on one of those stacks and slowly zoom out, you will see that the two photos are always clustered/unclustered. It is easier to see on a real device.

CCHMapClusterProblem.zip

Here's a video on how to reproduce : https://youtu.be/qo_9DAKU_KI

@choefele
Copy link
Owner

I can also reproduce the problem with the example that comes with the repo. This is a new problem – it looks like iOS 10 changed something so that the rect alignment used for the cluster cells doesn't work any more.

@dernise, @alexsteinerde can you have a look for a possible solution? I won#t be able to work on this for the next week or two

@choefele choefele added the bug label Oct 14, 2016
@Preen
Copy link

Preen commented May 4, 2017

Is there any news on this?

@choefele
Copy link
Owner

choefele commented May 5, 2017

Sorry, but I don't have time at the moment to look into this. Do you have an idea how to fix this?

Thanks

@tobias-r
Copy link

Any news on this?

@BenSS
Copy link

BenSS commented Sep 6, 2017 via email

@mxcl
Copy link

mxcl commented Mar 19, 2018

@BenSS If I may ask, which maintained solution did you use instead?

@tobias-r
Copy link

tobias-r commented Jun 19, 2018

Same problem here, tried the Apple Solution from iOS 11 but it's terribly slow with a lot of markers. I believe it works with graphical collision and needs to render all the markers before clustering, so your solution is 1000 times better. Any chance you could improve this?

@BenSS Which solution did you use?

@BenSS
Copy link

BenSS commented Jun 19, 2018

@tobias-r The original fix/PR I didn't really have time to clean up was make sure the added views were removed. At the time they were left hanging around, so you could end up with hundreds stacked on top of each other.

We moved to Kingpin for iOS10, and using the built-in MapKit clustering for iOS 11+.

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

No branches or pull requests

7 participants