mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-22 08:17:30 +02:00
If any part of an address is present, allow fallback to "Address" preset
(closes #4353)
This commit is contained in:
+1
-1
@@ -1465,7 +1465,7 @@ en:
|
||||
label: Wikipedia
|
||||
presets:
|
||||
address:
|
||||
# 'addr:housenumber=*'
|
||||
# 'addr:*=*'
|
||||
name: Address
|
||||
terms: '<translate with synonyms or related terms for ''Address'', separated by commas>'
|
||||
advertising/billboard:
|
||||
|
||||
@@ -158,12 +158,15 @@
|
||||
"area"
|
||||
],
|
||||
"tags": {
|
||||
"addr:housenumber": "*"
|
||||
"addr:*": "*"
|
||||
},
|
||||
"addTags": {},
|
||||
"removeTags": {},
|
||||
"reference": {
|
||||
"key": "addr"
|
||||
},
|
||||
"name": "Address",
|
||||
"matchScore": 0.3
|
||||
"matchScore": 0.15
|
||||
},
|
||||
"advertising/billboard": {
|
||||
"fields": [
|
||||
@@ -12109,16 +12112,16 @@
|
||||
"name": "Tram"
|
||||
},
|
||||
"relation": {
|
||||
"name": "Relation",
|
||||
"icon": "relation",
|
||||
"tags": {},
|
||||
"geometry": [
|
||||
"relation"
|
||||
],
|
||||
"fields": [
|
||||
"name",
|
||||
"relation"
|
||||
]
|
||||
],
|
||||
"geometry": [
|
||||
"relation"
|
||||
],
|
||||
"tags": {},
|
||||
"name": "Relation"
|
||||
},
|
||||
"route/ferry": {
|
||||
"icon": "ferry-line",
|
||||
|
||||
@@ -8,10 +8,13 @@
|
||||
"area"
|
||||
],
|
||||
"tags": {
|
||||
"addr:housenumber": "*"
|
||||
"addr:*": "*"
|
||||
},
|
||||
"addTags": {},
|
||||
"removeTags": {},
|
||||
"reference": {
|
||||
"key": "addr"
|
||||
},
|
||||
"name": "Address",
|
||||
"matchScore": 0.3
|
||||
"matchScore": 0.15
|
||||
}
|
||||
|
||||
+1
-1
@@ -41,7 +41,7 @@
|
||||
"key": "waterway"
|
||||
},
|
||||
{
|
||||
"key": "addr:housenumber"
|
||||
"key": "addr:*"
|
||||
},
|
||||
{
|
||||
"key": "advertising",
|
||||
|
||||
@@ -32,8 +32,9 @@ export function presetIndex() {
|
||||
|
||||
all.match = function(entity, resolver) {
|
||||
var geometry = entity.geometry(resolver);
|
||||
var address;
|
||||
|
||||
// Treat entities on addr:interpolation lines as points, not vertices (#3241)
|
||||
// Treat entities on addr:interpolation lines as points, not vertices - #3241
|
||||
if (geometry === 'vertex' && entity.isOnAddressLine(resolver)) {
|
||||
geometry = 'point';
|
||||
}
|
||||
@@ -43,6 +44,12 @@ export function presetIndex() {
|
||||
match;
|
||||
|
||||
for (var k in entity.tags) {
|
||||
// If any part of an address is present,
|
||||
// allow fallback to "Address" preset - #4353
|
||||
if (k.match(/^addr:/) !== null && geometryMatches['addr:*']) {
|
||||
address = geometryMatches['addr:*'][0];
|
||||
}
|
||||
|
||||
var keyMatches = geometryMatches[k];
|
||||
if (!keyMatches) continue;
|
||||
|
||||
@@ -55,6 +62,10 @@ export function presetIndex() {
|
||||
}
|
||||
}
|
||||
|
||||
if (address && (!match || match.isFallback())) {
|
||||
match = address;
|
||||
}
|
||||
|
||||
return match || all.item(geometry);
|
||||
};
|
||||
|
||||
|
||||
@@ -183,11 +183,19 @@ export function uiEntityEditor(context) {
|
||||
function historyChanged() {
|
||||
if (state === 'hide') return;
|
||||
|
||||
var entity = context.hasEntity(entityId),
|
||||
graph = context.graph();
|
||||
var entity = context.hasEntity(entityId);
|
||||
var graph = context.graph();
|
||||
if (!entity) return;
|
||||
|
||||
entityEditor.preset(context.presets().match(entity, graph));
|
||||
var match = context.presets().match(entity, graph);
|
||||
var activePreset = entityEditor.preset();
|
||||
var weakPreset = activePreset && _.isEmpty(activePreset.addTags);
|
||||
|
||||
// A "weak" preset doesn't set any tags. (e.g. "Address")
|
||||
// Don't replace a weak preset with a fallback preset (e.g. "Point")
|
||||
if (!(weakPreset && match.isFallback())) {
|
||||
entityEditor.preset(match);
|
||||
}
|
||||
entityEditor.modified(base !== graph);
|
||||
entityEditor(selection);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user