ui-leaflet icon indicating copy to clipboard operation
ui-leaflet copied to clipboard

markercluster events

Open nmccready opened this issue 8 years ago • 2 comments

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 avatar Nov 02 '15 17:11 nmccready

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);
            }
        });
    });

nmccready avatar Nov 02 '15 17:11 nmccready

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

ghost avatar Mar 21 '16 21:03 ghost