Link search results directly to browse pages
This commit is contained in:
parent
9f3dace353
commit
ee9642a28b
2 changed files with 9 additions and 20 deletions
|
@ -26,26 +26,20 @@ OSM.Search = function(map) {
|
|||
}
|
||||
|
||||
function clickSearchResult(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
var data = $(this).data(),
|
||||
center = L.latLng(data.lat, data.lon);
|
||||
|
||||
if (data.type && data.id) return; // Browse link
|
||||
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
if (data.minLon && data.minLat && data.maxLon && data.maxLat) {
|
||||
map.fitBounds([[data.minLat, data.minLon],
|
||||
[data.maxLat, data.maxLon]]);
|
||||
} else {
|
||||
map.setView(center, data.zoom);
|
||||
}
|
||||
|
||||
marker
|
||||
.setLatLng(center)
|
||||
.addTo(map);
|
||||
|
||||
if (data.type && data.id) {
|
||||
map.addObject(data, { zoom: false, style: { opacity: 0.2, fill: false } });
|
||||
}
|
||||
}
|
||||
|
||||
var marker = L.marker([0, 0], {icon: getUserIcon()});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue