Skip to content
This repository has been archived by the owner on Sep 20, 2019. It is now read-only.

markercluster events #146

Open
nmccready opened this issue Nov 2, 2015 · 2 comments
Open

markercluster events #146

nmccready opened this issue Nov 2, 2015 · 2 comments

Comments

@nmccready
Copy link
Contributor

From @azatoth on March 10, 2015 16:50

markercluster adds "cluster" + eventName events to markers; afaik, possible events are hardcoded in leafletEvents.js.

Would it be possible to remedy this to some extent?

Copied from original issue: tombatossals/angular-leaflet-directive#648

@nmccready
Copy link
Contributor Author

From @joeljeske on March 16, 2015 15:7

I got around this for now by doing this by get the layer directly. Note this code is in a directive, so layersCtrl is the injected controller into the link function when using the require options in the directive definition.

layersCtrl.getLayers()
    .then(function(layers) {
        var layer = layers.overlays[layerId];
        layer.on('clusterclick', function(e) {
            var map      = e.target._map,
                children = e.layer.getAllChildMarkers(),
                latlng   = e.latlng;

            if (map._zoom >= map._layersMaxZoom) {
                showPopup(map, children, latlng);
            }
        });
    });

@ghost
Copy link

ghost commented Mar 21, 2016

Is there any full example how to make and use this directive?

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

No branches or pull requests

1 participant