mirror of
https://github.com/FoggedLens/iD.git
synced 2026-04-05 03:22:25 +02:00
Optimize use of iD.svg.Points.points
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user