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

Cluster views change their location constantly when zooming (even very slightly) on low zoom #60

Closed
IVANKRUPSKI opened this issue Nov 23, 2017 · 39 comments
Labels

Comments

@IVANKRUPSKI
Copy link

IVANKRUPSKI commented Nov 23, 2017

Issue Description

(1) Cluster views change their location constantly when zooming (even very slightly) on low zoom, (2) they move far from the actual pins locations,
(3) occasionally on very low zoom pins pop up.

All this somehow linked to this method manager.shouldCenterAlignClusters = true

Screenshots

screenshot at nov 23 15-23-57

Environment

  • iOS Version: IOS 11, IOS 10
  • Device(s): iPhone 6s+, iPhone 5
@efremidze
Copy link
Owner

Does it work properly when manager.shouldCenterAlignClusters = false?

@IVANKRUPSKI
Copy link
Author

IVANKRUPSKI commented Nov 23, 2017 via email

@josepfm
Copy link

josepfm commented Nov 24, 2017

It happens to me too. It put the group on top of the sea when in reality there is no one there.
Any help?

@efremidze
Copy link
Owner

The pins shouldn't be centered, only the clusters. Ill take a look. The clusters landing in the sea are normal since it is placing them in the center of quadrants.

@josepfm
Copy link

josepfm commented Nov 24, 2017

You could modify it so that the clusters are created, not in the center, if not in reference to the last or first of the pins with a bit of deviation, if you want.

I think it would be a good idea.

I have three pins in Spain, and when zooming out, as are the 3 near the coast, place the cluster in the sea.

@efremidze
Copy link
Owner

efremidze commented Nov 24, 2017

In your case I would set manager.shouldCenterAlignClusters = false since it does that exactly.

@josepfm
Copy link

josepfm commented Nov 26, 2017

With manager.shouldCenterAlignClusters = true, the pins , when zooming out, as are the 3 near the coast, place the cluster in the sea.

Could you tell me how to modify your excellent library so that the tool set is placed in the coordinates of the last or first pin?

@efremidze
Copy link
Owner

efremidze commented Nov 27, 2017

I meant manager.shouldCenterAlignClusters = false should do that. It places the cluster based on the average coordinate. I could use median instead.

@josepfm
Copy link

josepfm commented Nov 28, 2017

I have a bigger problem

When the change is the location, often do not see the pines if I do not zoom and zoom out, and sometimes even doing so not all are displayed.

Could you help me, please, to solve this?

It is very important for my project.

@efremidze
Copy link
Owner

efremidze commented Nov 28, 2017

Im adding options for displaying clusters (center, first, average), however ur issue is probably unrelated. Please post an example so I can reproduce it.

@efremidze efremidze added the bug label Nov 29, 2017
@efremidze
Copy link
Owner

efremidze commented Nov 29, 2017

I reproduced the bug. I'll try to get to this as soon as possible, but if you have a fix for it, pull-requests are always welcome!

@efremidze
Copy link
Owner

efremidze commented Dec 1, 2017

Fixed in 2.1.0

@dneykov
Copy link

dneykov commented Dec 6, 2017

I have similar problem with 2.1.0
I have clusters in 2 continents and when I zoom out to see both clusters, cluster counts are changing when when changing zoom levels.

@efremidze
Copy link
Owner

efremidze commented Dec 6, 2017

I don't think thats a bug, its by design.

@dneykov
Copy link

dneykov commented Dec 6, 2017

I don't think is normal because I have cluster with about 3k annotations in Africa and 6k in Europe. When I'm slightly changing zoom level these numbers swaps. So it shows 3k in Europe and 6k in Africa which is totally wrong.

UPDATE: This is not happening with version 1.0.7 This occurs after 1.0.8

@josepfm
Copy link

josepfm commented Dec 6, 2017

Now it works worse.

When I change the location of the map, it does not show me the annotations or the clusters.

When I charge it for the first time either.

I have to be zooming so that they start to see each other.

You could review it?

@efremidze
Copy link
Owner

efremidze commented Dec 6, 2017

@dneykov Ill look into that. Are experiencing the same issue with 2.1.0?
@jose46moreno which version?

@efremidze efremidze reopened this Dec 6, 2017
@efremidze
Copy link
Owner

Im testing it and everything appears right. Ill add unit tests. Help is appreciated.

@dneykov
Copy link

dneykov commented Dec 7, 2017

@efremidze Yes this is the case in 2.1.0 as well
Here are examples on different zoom levels with 2.1.0

screen shot 2017-12-07 at 9 48 02 am copy
screen shot 2017-12-07 at 9 52 10 am copy
screen shot 2017-12-07 at 9 52 27 am copy

@efremidze
Copy link
Owner

What clusterPosition are you using?

@dneykov
Copy link

dneykov commented Dec 7, 2017

manager.clusterPosition = .nearCenter

@efremidze
Copy link
Owner

efremidze commented Dec 7, 2017

r u having the same issue when setting clusterPosition to .center or .average?

@dneykov
Copy link

dneykov commented Dec 7, 2017

@efremidze I have tried . center before but the result is the same. I didn't tried . average but can try it at Monday and will let you know the result.

@josepfm
Copy link

josepfm commented Dec 7, 2017

@efremidze the version is 2.1.0.

Besides the problem that clusters do not appear at times, it also happens to me as a @dneykov and that is that it moves position clusters when I zoom.

@tdimeco
Copy link

tdimeco commented Dec 8, 2017

Actually this is an old issue, see #15.

@dneykov
Copy link

dneykov commented Dec 8, 2017

In #15 the problem is solved with version 1.0.7 as I mentioned above version 1.0.7 works as expected but the versions after that have same problem.

@josepfm
Copy link

josepfm commented Dec 8, 2017

Help?

@efremidze
Copy link
Owner

Its not related to #15, that issue related to a meridian bug.

@efremidze
Copy link
Owner

Can u guys send me a sample project to reproduce?

@josepfm
Copy link

josepfm commented Dec 9, 2017

@efremidze here I leave a link to my Dropbox folder with the video where you can see the error:

https://www.dropbox.com/sh/exo23lipw6n0hs6/AACALNR29SY7v881CYZjcGRka?dl=0

And an image where I print the number of annotations by console:

captura de pantalla 2017-12-09 a las 10 19 20

Result:

captura de pantalla 2017-12-09 a las 10 18 39

@josepfm
Copy link

josepfm commented Dec 9, 2017

Here you can see the entire function that runs in the viewWillAppear.

captura de pantalla 2017-12-09 a las 11 21 30

The problem is that when you add the annotations to the manager, it does not call the method ViewFor of MapKit (I have put a print on that method and it does not run)

@efremidze
Copy link
Owner

efremidze commented Dec 11, 2017

I'm unable to reproduce it.
Regarding your setup, mapView.centerCoordinate doesn't call viewFor:, regionDidChangeAnimated: or reload:. Call manager.reload(mapView, visibleMapRect: mapView.visibleMapRect) to reload the map.

@dneykov
Copy link

dneykov commented Dec 13, 2017

I completely rewrote my mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) delegate method and now everything seems to work as expected with manager.clusterPosition = . average and Cluster version 2.1.0

@IVANKRUPSKI
Copy link
Author

Great!
manager.clusterPosition = .average does the work.

However there again appeared the problem that was described in #49.
Any chances it could be solved?

@efremidze
Copy link
Owner

Increasing the cell size fixes that issue, however it needs to be done dynamically. I need to investigate a good solution for that.

@josepfm
Copy link

josepfm commented Dec 16, 2017

@efremidze You think you could implement some animation for the grouping and ungrouping of the annotations.

Something like they all come together at one point and separate.

It would be incredible and improve the user experience.

@IVANKRUPSKI
Copy link
Author

Sorry didn't get it. What is meant by the cell size?
This -> manager.maxZoomLevel = 20 ?

@efremidze
Copy link
Owner

@jose46moreno I'll create a separate issue for that

@IVANKRUPSKI manager.cellSize = 20

@IVANKRUPSKI
Copy link
Author

Got it, thanks!

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

5 participants