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

Spiderfier with sub sipiderfier when too many markers #143

Open
crismethods opened this issue Oct 11, 2017 · 2 comments
Open

Spiderfier with sub sipiderfier when too many markers #143

crismethods opened this issue Oct 11, 2017 · 2 comments

Comments

@crismethods
Copy link

With the team I am working we have seen different behaviours using this library, not all of them part of what we expected, and we are wondering if it is a resource/performance issue when there are too many markers. For instance there are 104 markers in the same position, and the resulting behaviour is the one shown in the images attached in this ticket. This not always happen in the same way, sometimes the click shows only part of the markers in the Spider way, and if the Spiderfier is closed and then opened again it shows different amount of markers, any workaround for that when are too many objects?

Thank you!
screen shot 2017-10-11 at 11 36 21
screen shot 2017-10-11 at 11 59 14

@jawj
Copy link
Owner

jawj commented Nov 6, 2017

Hmm — weird. I wouldn't have thought 104 markers would be too many. Are you using clustering too? And could you share some code where this happens?

@crismethods
Copy link
Author

Yes, we are using clustering as well (previously MarkerclustererPlus and now gmap-marker-cluster), a piece of code is:

    this.markerClusterer.addListener("clusterclick", (cluster) => {
      let markers = cluster.getMarkers();
      if (this.markersSamePosition(markers)) {
        let last_marker = markers.slice(-1)[0];
        this.markerClusterer.setMaxZoom(15);
        this.map.setZoom(17);
        this.map.setCenter(cluster.getCenter());
        setTimeout(
          () => {
            Map.triggerEvent(last_marker, "click");
          },
          700
        );
      } 
     ...
     ...
    });

So basically our cluster doesnt respond to the default click but we implement our own. We have the situation that we could have many markers at the same location, so when that is the case, then we trigger the click on the last marker for that cluster, and then the Spiderfy is triggered. So we realised that the timeout is affecting the way the Spiderfier displays the markers, and 700 was the value where most of the time there were displayed correctly, but as you know playing with timers means depending on the client' side, just wondering if that could be a reason for that.

Thanks!

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