ui-leaflet
ui-leaflet copied to clipboard
markercluster events
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
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);
}
});
});
Is there any full example how to make and use this directive?