Search for portals: select portal on click

This commit is contained in:
fkloft 2015-02-12 15:51:42 +01:00
parent 6b027d15fe
commit 46a1684549
2 changed files with 12 additions and 0 deletions

View File

@ -234,6 +234,15 @@ addHook('search', function(query) {
title: portal.options.data.title,
position: portal.getLatLng(),
icon: 'data:image/svg+xml;base64,'+btoa('@@INCLUDESTRING:images/icon-portal.svg@@'.replace(/%COLOR%/g, color)),
onSelected: function(result, event) {
if(event.type == 'dblclick')
zoomToAndShowPortal(guid, portal.getLatLng());
else if(window.portals[guid])
renderPortalDetails(guid);
else
window.selectPortalByLatLng(portal.getLatLng());
return true; // prevent default behavior
},
});
}
});

View File

@ -273,6 +273,9 @@ window.selectPortalByLatLng = function(lat, lng) {
if(lng === undefined && lat instanceof Array) {
lng = lat[1];
lat = lat[0];
} else if(lng === undefined && lat instanceof L.LatLng) {
lng = lat.lng;
lat = lat.lat;
}
for(var guid in window.portals) {
var latlng = window.portals[guid].getLatLng();