Display features in sidebar list only on search (#1629)

This commit is contained in:
John Firebaugh
2013-07-25 14:58:20 -07:00
parent 266687b515
commit f579795dee
3 changed files with 7 additions and 8 deletions

View File

@@ -187,7 +187,7 @@ en:
search: Search
unknown: Unknown
incomplete: <not downloaded>
feature_list: Feature list
feature_list: Search features
edit: Edit feature
background:
title: Background

View File

@@ -230,7 +230,7 @@
"search": "Search",
"unknown": "Unknown",
"incomplete": "<not downloaded>",
"feature_list": "Feature list",
"feature_list": "Search features",
"edit": "Edit feature"
},
"background": {

View File

@@ -50,21 +50,20 @@ iD.ui.FeatureList = function(context) {
graph = context.graph(),
q = search.property('value').toLowerCase();
if (!q) return result;
function addEntity(entity) {
if (entity.id in entities || result.length > 200)
return;
entities[entity.id] = true;
var preset = context.presets().match(entity, graph),
name = iD.util.displayName(entity) || '';
if (!q || name.toLowerCase().indexOf(q) >= 0 ||
preset.name().toLowerCase().indexOf(q) >= 0) {
var name = iD.util.displayName(entity) || '';
if (name.toLowerCase().indexOf(q) >= 0) {
result.push({
entity: entity,
geometry: context.geometry(entity.id),
preset: preset,
preset: context.presets().match(entity, graph),
name: name
});
}