Commit 3f80ef0d by Rashid Khan

Merge pull request #705 from bpezan/bettermap

better performance when adding thousands of markers to bettermap.
parents d0f90b00 8c2816a7
......@@ -213,14 +213,18 @@ function (angular, app, _, L, localRequire) {
layerGroup.clearLayers();
}
var markerList = [];
_.each(scope.data, function(p) {
if(!_.isUndefined(p.tooltip) && p.tooltip !== '') {
layerGroup.addLayer(L.marker(p.coordinates).bindLabel(p.tooltip));
markerList.push(L.marker(p.coordinates).bindLabel(p.tooltip));
} else {
layerGroup.addLayer(L.marker(p.coordinates));
markerList.push(L.marker(p.coordinates));
}
});
layerGroup.addLayers(markerList);
layerGroup.addTo(map);
map.fitBounds(_.pluck(scope.data,'coordinates'));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment