diff --git a/modules/ui/feature_list.js b/modules/ui/feature_list.js index a30253d6b..69b9709b7 100644 --- a/modules/ui/feature_list.js +++ b/modules/ui/feature_list.js @@ -122,19 +122,6 @@ export function uiFeatureList(context) { if (!q) return result; - var idMatch = q.match(/(?:^|\W)(node|way|relation|[nwr])\W?0*([1-9]\d*)(?:\W|$)/i); - - if (idMatch) { - var elemType = idMatch[1].charAt(0); - var elemId = idMatch[2]; - result.push({ - id: elemType + elemId, - geometry: elemType === 'n' ? 'point' : elemType === 'w' ? 'line' : 'relation', - type: elemType === 'n' ? t('inspector.node') : elemType === 'w' ? t('inspector.way') : t('inspector.relation'), - name: elemId - }); - } - var locationMatch = sexagesimal.pair(q.toUpperCase()) || q.match(/^(-?\d+\.?\d*)\s+(-?\d+\.?\d*)$/); if (locationMatch) { @@ -148,6 +135,20 @@ export function uiFeatureList(context) { }); } + // A location search takes priority over an ID search + var idMatch = !locationMatch && q.match(/(?:^|\W)(node|way|relation|[nwr])\W?0*([1-9]\d*)(?:\W|$)/i); + + if (idMatch) { + var elemType = idMatch[1].charAt(0); + var elemId = idMatch[2]; + result.push({ + id: elemType + elemId, + geometry: elemType === 'n' ? 'point' : elemType === 'w' ? 'line' : 'relation', + type: elemType === 'n' ? t('inspector.node') : elemType === 'w' ? t('inspector.way') : t('inspector.relation'), + name: elemId + }); + } + var allEntities = graph.entities; var localResults = []; for (var id in allEntities) {