2 things related to gatherStats auto-hiding..

* skip gatherStats on differenced redraws..
* force full redraw when gatherStats autohides/unhides features
  (before: extent redraws would happen, counts would update,
   but buildings/points would stay on the screen)
This commit is contained in:
Bryan Housel
2014-10-31 11:58:02 -04:00
parent 224db06ca4
commit c941bd5a4b
2 changed files with 21 additions and 9 deletions

View File

@@ -212,7 +212,9 @@ iD.Features = function(context) {
features.gatherStats = function(d, graph, dimensions) {
var hidden = features.hidden(),
keys = features.keys();
keys = features.keys(),
needsRedraw = false;
resolver = graph || resolver;
_.each(feature, function(f) { f.count = 0; });
@@ -231,7 +233,10 @@ iD.Features = function(context) {
if (hidden !== features.hidden()) {
dispatch.change();
needsRedraw = true;
}
return needsRedraw;
};
features.stats = function() {

View File

@@ -105,17 +105,24 @@ iD.Map = function(context) {
data = _.compact(_.values(complete));
filter = function(d) { return d.id in complete; };
} else if (extent) {
data = context.intersects(map.extent().intersection(extent));
var set = d3.set(_.pluck(data, 'id'));
filter = function(d) { return set.has(d.id); };
} else {
data = all;
filter = d3.functor(true);
// force a full redraw if gatherStats detects that a feature
// should be auto-hidden (e.g. points or buildings)..
if (features.gatherStats(all, graph, dimensions)) {
extent = undefined;
}
if (extent) {
data = context.intersects(map.extent().intersection(extent));
var set = d3.set(_.pluck(data, 'id'));
filter = function(d) { return set.has(d.id); };
} else {
data = all;
filter = d3.functor(true);
}
}
features.gatherStats(all, graph, dimensions);
data = features.filter(data, graph);
surface