From ea1e626d4114e963375601f66a583c23ef5e7789 Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Sun, 20 Dec 2015 00:33:22 -0500 Subject: [PATCH] Center map on feature when selecting feature from search results --- js/id/ui/feature_list.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/js/id/ui/feature_list.js b/js/id/ui/feature_list.js index dc5db11dc..0b7dacc3f 100644 --- a/js/id/ui/feature_list.js +++ b/js/id/ui/feature_list.js @@ -223,6 +223,13 @@ iD.ui.FeatureList = function(context) { context.map().centerZoom([d.location[1], d.location[0]], 20); } else if (d.entity) { + if (d.entity.type === 'node') { + context.map().center(d.entity.loc); + } else if (d.entity.type === 'way') { + var center = context.projection(context.map().center()), + edge = iD.geo.chooseEdge(context.childNodes(d.entity), center, context.projection); + context.map().center(edge.loc); + } context.enter(iD.modes.Select(context, [d.entity.id]).suppressMenu(true)); } else { context.zoomToEntity(d.id);