diff --git a/data/core.yaml b/data/core.yaml index 3f2de3b85..362a49eb6 100644 --- a/data/core.yaml +++ b/data/core.yaml @@ -253,6 +253,7 @@ en: show_features: Show Map Features show_layers: Show Data Layers fill_area: Fill Areas + autohidden: "These features have been automatically hidden because too many would be shown on the screen. You can zoom in to edit them." feature: points: description: Points diff --git a/dist/locales/en.json b/dist/locales/en.json index 507abc9d9..1e7a82206 100644 --- a/dist/locales/en.json +++ b/dist/locales/en.json @@ -307,7 +307,8 @@ "description": "Map Data", "show_features": "Show Map Features", "show_layers": "Show Data Layers", - "fill_area": "Fill Areas" + "fill_area": "Fill Areas", + "autohidden": "These features have been automatically hidden because too many would be shown on the screen. You can zoom in to edit them." }, "feature": { "points": { diff --git a/js/id/renderer/features.js b/js/id/renderer/features.js index ffe4b11a0..734c70bd7 100644 --- a/js/id/renderer/features.js +++ b/js/id/renderer/features.js @@ -45,6 +45,11 @@ iD.Features = function(context) { feature = {}, cullFactor = 1; + function update() { + dispatch.change(); + dispatch.redraw(); + } + function defineFeature(k, filter, max) { feature[k] = { filter: filter, @@ -54,16 +59,11 @@ iD.Features = function(context) { defaultMax: (max || Infinity), enable: function() { this.enabled = true; this.currentMax = this.defaultMax; }, disable: function() { this.enabled = false; this.currentMax = 0; }, - hidden: function() { return this.count > this.currentMax * cullFactor; } + hidden: function() { return this.count > this.currentMax * cullFactor; }, + autoHidden: function() { return this.hidden() && this.currentMax > 0; } }; } - function update() { - dispatch.change(); - dispatch.redraw(); - } - - defineFeature('points', function(entity) { return entity.geometry(context.graph()) === 'point'; @@ -181,6 +181,13 @@ iD.Features = function(context) { return feature[k] && feature[k].hidden(); }; + features.autoHidden = function(k) { + if (!arguments.length) { + return _.filter(features.keys(), function(k) { return feature[k].autoHidden(); }); + } + return feature[k] && feature[k].autoHidden(); + }; + features.enable = function(k) { if (feature[k] && !feature[k].enabled) { feature[k].enable(); diff --git a/js/id/ui/map_data.js b/js/id/ui/map_data.js index df61e7e37..16d308ad2 100644 --- a/js/id/ui/map_data.js +++ b/js/id/ui/map_data.js @@ -8,7 +8,11 @@ iD.ui.MapData = function(context) { function map_data(selection) { function showsFeature(d) { - return context.features().enabled(d); + return autoHiddenFeature(d) ? null : !context.features().hidden(d); + } + + function autoHiddenFeature(d) { + return context.features().autoHidden(d); } function clickFeature(d) { @@ -54,11 +58,16 @@ iD.ui.MapData = function(context) { .call(bootstrap.tooltip() .html(true) .title(function(d) { - return iD.ui.tooltipHtml( - t(name + '.' + d + '.tooltip'), (d === 'wireframe' ? 'W' : null) - ); + var tip = t(name + '.' + d + '.tooltip'), + key = (d === 'wireframe' ? 'W' : null); + + if (name === 'feature' && autoHiddenFeature(d)) { + tip += '