Skip to content

Commit

Permalink
Merge pull request #7775 from blackboxlogic/FlexibleElementSearch
Browse files Browse the repository at this point in the history
Flexible Element Search
  • Loading branch information
kymckay authored Jul 12, 2020
2 parents 5d52df4 + 0789b86 commit 1a86289
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions modules/ui/feature_list.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,16 @@ export function uiFeatureList(context) {

if (!q) return result;

var idMatch = q.match(/^([nwr])([0-9]+)$/);
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: idMatch[0],
geometry: idMatch[1] === 'n' ? 'point' : idMatch[1] === 'w' ? 'line' : 'relation',
type: idMatch[1] === 'n' ? t('inspector.node') : idMatch[1] === 'w' ? t('inspector.way') : t('inspector.relation'),
name: idMatch[2]
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
});
}

Expand Down

0 comments on commit 1a86289

Please sign in to comment.