From 0689ab7f7196415db064abb6eec133e007634d2e Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Tue, 18 Jun 2013 16:23:02 -0700 Subject: [PATCH] Restore differenced point rendering (#569, #1604) --- js/id/renderer/map.js | 7 ++++++- js/id/svg/points.js | 12 +++--------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/js/id/renderer/map.js b/js/id/renderer/map.js index 763d6a0f2..cd06aa42a 100644 --- a/js/id/renderer/map.js +++ b/js/id/renderer/map.js @@ -138,13 +138,18 @@ iD.Map = function(context) { } surface - .call(points) .call(vertices, graph, all, filter, map.extent(), map.zoom()) .call(lines, graph, all, filter) .call(areas, graph, all, filter) .call(midpoints, graph, all, filter, map.extent()) .call(labels, graph, all, filter, dimensions, !difference && !extent); + if (points.points(context.intersects(map.extent())).length > 100) { + surface.select('.layer-hit').selectAll('g.point').remove(); + } else { + surface.call(points, points.points(all), filter); + } + dispatch.drawn({full: true}); } diff --git a/js/id/svg/points.js b/js/id/svg/points.js index 1c0ce9f2c..e28ee1062 100644 --- a/js/id/svg/points.js +++ b/js/id/svg/points.js @@ -10,16 +10,11 @@ iD.svg.Points = function(projection, context) { return b.loc[1] - a.loc[1]; } - function drawPoints(surface, points) { - points = points || drawPoints.points(); - - if (points.length > 100) { - return surface.select('.layer-hit').selectAll('g.point').remove(); - } - + function drawPoints(surface, points, filter) { points.sort(sortY); var groups = surface.select('.layer-hit').selectAll('g.point') + .filter(filter) .data(points, iD.Entity.key); var group = groups.enter() @@ -55,9 +50,8 @@ iD.svg.Points = function(projection, context) { .remove(); } - drawPoints.points = function() { + drawPoints.points = function(entities) { var graph = context.graph(), - entities = context.intersects(context.extent()), points = []; for (var i = 0; i < entities.length; i++) {