mirror of
https://github.com/FoggedLens/iD.git
synced 2026-03-13 06:36:28 +00:00
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:
@@ -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() {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user