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

[Bug] MarkerClustering Redraw() do not work #204

Closed
markschroeder77 opened this issue Aug 22, 2022 · 5 comments
Closed

[Bug] MarkerClustering Redraw() do not work #204

markschroeder77 opened this issue Aug 22, 2022 · 5 comments

Comments

@markschroeder77
Copy link
Contributor

markschroeder77 commented Aug 22, 2022

Can anyone confirm if the markerClustering.Redraw method works.

I'm trying to hide a marker and refresh the clustering.

Calling

await marker.SetVisible(value);
await markerClustering.Redraw();

Doesn't work, but calling

await marker.SetVisible(value);
await markerClustering.ClearMarkers();
await markerClustering.AddMarkers(markers);

does work.

@markschroeder77 markschroeder77 changed the title markClustering.Redraw() markerClustering.Redraw() Aug 22, 2022
@valentasm1
Copy link
Collaborator

I couldnt find that option in documentations
https://googlemaps.github.io/js-markerclusterer/
@TheAtomicOption maybe you know more about redraw?

@markschroeder77
Copy link
Contributor Author

Yeah, it looks like that redraw method was available a long time ago, but it's gone now. https://groups.google.com/g/google-maps-js-api-v3/c/kspTUjVcFsY

Rather than calling ClearMarkers() and adding all the markers back with AddMarkers(), I'm rather just going to remove the updated markers with RemoveMarkers() and then add only the update ones back in with AddMarkers().

There was a problem with the RemoveMarkers() method though.
The fix is here https://github.com/markschroeder77/BlazorGoogleMaps

@valentasm1
Copy link
Collaborator

I will try review your changes and and merge

@TheAtomicOption
Copy link
Contributor

TheAtomicOption commented Aug 24, 2022

Your links aren't working for me but...

I know this was working 6 months ago when I was last doing a lot of work on this project. Looks like the current method to redraw is now render() on the js side. (https://googlemaps.github.io/js-markerclusterer/interfaces/Renderer.html#render) and it gets called automatically if you pass false to the NoDraw parameter for Add/RemoveMarker(s) functions (https://github.com/googlemaps/js-markerclusterer/blob/main/src/markerclusterer.ts#L115). Repaint/Redraw are old method names from previous rewrites of the js module.

so presumably the text string here https://github.com/rungwiroon/BlazorGoogleMaps/blob/master/GoogleMapsComponents/Maps/MarkerClustering.cs#L143
should be updated to "render"

For completeness we should probably make ReDraw [Obsolete] as well and create a Render() method to match the JS naming, similar to what was done for Repaint

@valentasm1 valentasm1 changed the title markerClustering.Redraw() [Bug] MarkerClustering Redraw() do not work Aug 27, 2022
@valentasm1
Copy link
Collaborator

I updated redraw to render
https://www.nuget.org/packages/BlazorGoogleMaps/2.2.4

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

3 participants