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

[MarkerClusterer] Repaints the map for every marker to add / remove #395

Closed
amangeot opened this issue Nov 24, 2016 · 2 comments
Closed

Comments

@amangeot
Copy link
Contributor

Hello,
I think this issue still exists in v6: #210

The issue is that MarkerClusterer is passed down to Markers within the context, so that Marker can add itself to the MarkerClusterer. Then the underlying addMarker or removeMarker forces a redraw on the map, for each added or removed marker.

From Marker.js:
In getInitialState(): markerClusterer.addMarker(marker);
In componentWillUnmount(): markerClusterer.removeMarker(marker)

Now from markerclustererplus.js:

MarkerClusterer.prototype.addMarker = function (marker, opt_nodraw) {
  this.pushMarkerTo_(marker);
  if (!opt_nodraw) {
    this.redraw_();
  }
}

Not sure to be competent enough for this job, but I'll try my best to add a pull request that solves this issue.

@amangeot
Copy link
Contributor Author

I forked the project and edited these two lines in Marker.js to prevent every added / removed Markers from redrawing clusters:
In getInitialState(): markerClusterer.addMarker(marker, true);
In componentWillUnmount(): markerClusterer.removeMarker(marker, true)`

@tomchentw
Copy link
Owner

Please refer to Getting Help section in the README (or #469).

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