Strange behavior when zooming in and out
Opened this issue · 14 comments
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.
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
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
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
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
Hello,
I have the same problem and would like to have a solution for this issue as well.
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.
Here's a video on how to reproduce : https://youtu.be/qo_9DAKU_KI
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
Is there any news on this?
Sorry, but I don't have time at the moment to look into this. Do you have an idea how to fix this?
Thanks
Any news on this?
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?
@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+.