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

Support for MarkerCluster sub-plugins #77

Open
elvir92 opened this issue Aug 6, 2018 · 5 comments
Open

Support for MarkerCluster sub-plugins #77

elvir92 opened this issue Aug 6, 2018 · 5 comments

Comments

@elvir92
Copy link

elvir92 commented Aug 6, 2018

Hi
Is there any way to inject sub-plugins like Freezable

@yuzhva
Copy link
Owner

yuzhva commented Aug 6, 2018

@elvir92 Em.. - nope, currently there is no way to do that, also I don't remember any example.

Need to think about implementation.

@elvir92 elvir92 closed this as completed Aug 6, 2018
@elvir92 elvir92 reopened this Aug 6, 2018
@elvir92
Copy link
Author

elvir92 commented Aug 6, 2018

Can you give me an advice, i would like to do it, but i don't know how to or where to start.

@yuzhva
Copy link
Owner

yuzhva commented Aug 6, 2018

According to Freezable doc. you need to use that lib directly with Leaflet element (wich was created by Leaflet.js):

var mcg = L.markerClusterGroup(options);

mcg.freezeAtZoom(15);
mcg.freezeAtZoom("maxKeepSpiderfy");
mcg.freezeAtZoom("max");

mcg - that is LeafleElelemnt.
You can try to get leaflet element of MarkerCluser by ref:

require('leaflet.markercluster.freezable');

...

handleMarkerClusterGroupLeafletElement(leafletElement) {
  this.leafletElement = leafletElement;

  // NOTE: here you can do whatever you need with leafletElement
  this.leafletElement.freezeAtZoom(15);
}

...

render() {
  return (
    <MarkerClusterGroup ref={handleMarkerClusterGroupLeafletElement}>
      <Marker position={[49.8397, 24.0297]} />
      <Marker position={[52.2297, 21.0122]} />
      <Marker position={[51.5074, -0.0901]} />
    </MarkerClusterGroup>
  )
}

@wmertens
Copy link

FYI, the placementStrategies sub-plugin can just be imported and it works. So it depends on the sub-plugins.

@dpadula
Copy link

dpadula commented Jan 21, 2021

Hello, what about the clustering and clustering dynamically/programmatically?. In react at least, I have to add FeatureGroup or MarkerClusterGroup accordingly If I must to show markers clustered or unclustered.
Is there a chance to do this programmatically?

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

No branches or pull requests

4 participants