Commit 8c2816a7 by byron pezan

better performance when adding thousands of markers to bettermap.

parent 5fc0f394
......@@ -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