mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-20 23:44:47 +02:00
Center map on feature when selecting feature from search results
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user