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

Is there a way to intercept the click to does not expand the pins in the last zoom level? #31

Open
pcsantana opened this issue Dec 4, 2015 · 6 comments

Comments

@pcsantana
Copy link

Hii,
First, thank you for sharing this great and useful lib.
I am trying to use it, but I want a little different behavior when I give zoom in the last level and is not be possible to ungroup the pins. In this scenario, I want to intercept the default behavior (replace the pins around the original coordinate when the user tap on pin). In my case I wish to display some list with the places data (because I need to show all shops (200+) in the mall, for example). But I was not be able to disable this default behavior and insert my code.

If there is a way, I appreciate it if you could help me.
Thank you very much!
Best regards,

Paulo Santana.

@pcsantana
Copy link
Author

Hi,
I found out! Just return "false" in:

  • (BOOL)mapView:(TSClusterMapView *)mapView shouldForceSplitClusterAnnotation:(ADClusterAnnotation *)clusterAnnotation;

    Thank you!!

@pcsantana
Copy link
Author

Hi,

If possible I would to suggest a little modification. If there are a lot of places very close to each other, with another places with exactly the same coordinates, the algorithm not call the method below:

-(BOOL)mapView:(TSClusterMapView *)mapView shouldForceSplitClusterAnnotation:(ADClusterAnnotation *)clusterAnnotation;

Debugging the code, I find out the reason. Because the method is only called when the groupedRounded annotations count is equal to 1:

//...TSClusterMapView class, in "splitClusterToOriginal:clusterAnnotation" method
NSDictionary *groupedRoundedLatLonAnnotations = [TSClusterOperation groupAnnotationsByLocationValue:[NSSet setWithArray:clusterAnnotation.cluster.originalAnnotations]];

//Here the condition
if (groupedRoundedLatLonAnnotations.allKeys.count == 1) {
    if ([_clusterDelegate respondsToSelector:@selector(mapView:shouldForceSplitClusterAnnotation:)]) {
        if (![_clusterDelegate mapView:self shouldForceSplitClusterAnnotation:clusterAnnotation]) {
            return;
        }
    }
}

Maybe this condition can be parameterized (count value). In my case, for example, I don't need this condition.
Please correct me if I am wrong.

Thank you very much!

@ashare80
Copy link
Owner

@pcsantana Hmm yeah I guess the idea there was that if they weren't close enough to get grouped together into 1 single shared coordinate it should always split.

I think we can just get rid of that if statement of that solves your problem?

@pcsantana
Copy link
Author

Yes @ashare80, I commented the if statement and it solved my problem

@ashare80
Copy link
Owner

@pcsantana ok cool next version will remove it

@pcsantana
Copy link
Author

Thank you! :)

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

No branches or pull requests

2 participants