mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-14 17:52:55 +00:00
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user