Use "building" label instead of "area" when adding POIs as buildings

This commit is contained in:
Quincy Morgan
2019-03-06 11:39:17 -05:00
parent 827ef0ece7
commit 36ad1b0242
5 changed files with 33 additions and 11 deletions
+2
View File
@@ -38,6 +38,8 @@ en:
title: "Add {feature} as a line"
area:
title: "Add {feature} as an area"
building:
title: "Add {feature} as a building"
vertex:
title: "Add {feature} as a vertex"
browse:
+3
View File
@@ -49,6 +49,9 @@
"area": {
"title": "Add {feature} as an area"
},
"building": {
"title": "Add {feature} as a building"
},
"vertex": {
"title": "Add {feature} as a vertex"
}
+4
View File
@@ -268,6 +268,10 @@ export function presetIndex() {
return presetCollection(_uniq(rec.concat(def).concat(all.item(geometry))));
};
all.recent = function(geometries, n) {
return presetCollection(_recent.matchAnyGeometry(geometries).collection.slice(0, n - 1));
}
all.choose = function(preset) {
if (preset.searchable !== false) {
_recent = presetCollection(_uniq([preset].concat(_recent.collection)));
+5 -1
View File
@@ -78,7 +78,11 @@ export function uiModes(context) {
});
var tooltipTitleID = 'modes.add_preset.title';
if (relevantMatchingGeometry.length !== 1) {
tooltipTitleID = 'modes.add_preset.' + d.geom + '.title';
if (preset.setTags({}, d.geom).building) {
tooltipTitleID = 'modes.add_preset.building.title';
} else {
tooltipTitleID = 'modes.add_preset.' + d.geom + '.title';
}
}
var favoriteMode = {
button: markerClass,
+19 -10
View File
@@ -132,17 +132,22 @@ export function uiSearchAdd(context) {
}
})
.on('input', function () {
popover.selectAll('.subsection').remove();
var value = search.property('value');
var results;
if (value.length) {
popover.selectAll('.subsection').remove();
var results = presets.search(value, shownGeometry);
list.call(drawList, results);
popover.selectAll('.list .list-item.focused')
.classed('focused', false);
focusListItem(popover.selectAll('.list > .list-item:first-child'));
results = presets.search(value, shownGeometry);
} else {
popover.selectAll('.list > *').remove();
results = context.presets().recent(shownGeometry, 36);
}
list.call(drawList, results);
popover.selectAll('.list .list-item.focused')
.classed('focused', false);
focusListItem(popover.selectAll('.list > .list-item:first-child'));
});
searchWrap
@@ -195,6 +200,9 @@ export function uiSearchAdd(context) {
}
function itemForPreset(preset) {
if (preset.members) {
return CategoryItem(preset);
}
var supportedGeometry = preset.geometry.filter(function(geometry) {
return shownGeometry.indexOf(geometry) !== -1;
}).sort();
@@ -212,9 +220,6 @@ export function uiSearchAdd(context) {
function drawList(list, presets) {
var collection = presets.collection.map(function(preset) {
if (preset.members) {
return CategoryItem(preset);
}
return itemForPreset(preset);
});
@@ -282,6 +287,9 @@ export function uiSearchAdd(context) {
label.append('span')
.text(function(d) {
if (d.isSubitem) {
if (d.preset.setTags({}, d.geometry).building) {
return t('presets.presets.building.name');
}
return t('modes.add_' + d.geometry + '.title');
}
return d.preset.name();
@@ -417,6 +425,7 @@ export function uiSearchAdd(context) {
mode = modeAddArea(context, modeInfo);
}
search.node().blur();
context.presets().choose(preset);
context.enter(mode);
};
return item;