select geocoder result

fixes #1235
This commit is contained in:
Ansis Brammanis
2013-04-02 12:51:17 -04:00
parent 450da6d510
commit 7a5fca1e8a

View File

@@ -55,11 +55,13 @@ iD.ui.Geocoder = function(context) {
resultsList.call(iD.ui.Toggle(true));
} else {
applyBounds(resultExtent(resp[0].boundingbox));
selectId(resp[0].osm_type, resp[0].osm_id);
}
});
}
function clickResult(d) {
selectId(d.osm_type, d.osm_id);
applyBounds(resultExtent(d.boundingbox));
}
@@ -70,6 +72,28 @@ iD.ui.Geocoder = function(context) {
if (map.zoom() > 19) map.zoom(19);
}
function selectId(type, id) {
id = type[0] + id;
if (context.entity(id)) {
context.enter(iD.modes.Select(context, [id]));
} else {
context.map().on('drawn.geocoder', function() {
if (!context.entity(id)) return;
context.enter(iD.modes.Select(context, [id]));
});
context.on('enter.geocoder', function() {
if (context.mode().id !== 'browse') {
context.map()
.on('drawn.geocoder', null)
.on('enter.geocoder', null);
}
});
}
}
var tooltip = bootstrap.tooltip()
.placement('right')
.html(true)