Optimize use of iD.svg.Points.points

This commit is contained in:
John Firebaugh
2013-08-26 15:54:58 -07:00
parent 30f68c4ef9
commit f3c6f3eca4
2 changed files with 3 additions and 2 deletions

View File

@@ -136,7 +136,7 @@ iD.Map = function(context) {
.call(midpoints, graph, all, filter, map.extent())
.call(labels, graph, all, filter, dimensions, !difference && !extent);
if (points.points(context.intersects(map.extent())).length > 100) {
if (points.points(context.intersects(map.extent()), 100).length >= 100) {
surface.select('.layer-hit').selectAll('g.point').remove();
} else {
surface.call(points, points.points(all), filter);

View File

@@ -50,7 +50,7 @@ iD.svg.Points = function(projection, context) {
.remove();
}
drawPoints.points = function(entities) {
drawPoints.points = function(entities, limit) {
var graph = context.graph(),
points = [];
@@ -58,6 +58,7 @@ iD.svg.Points = function(projection, context) {
var entity = entities[i];
if (entity.geometry(graph) === 'point') {
points.push(entity);
if (limit && points.length >= limit) break;
}
}