diff --git a/code/search.js b/code/search.js index ba17a11d..dcc2803d 100644 --- a/code/search.js +++ b/code/search.js @@ -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 + }, }); } }); diff --git a/code/utils_misc.js b/code/utils_misc.js index 0b978d28..81e5e865 100644 --- a/code/utils_misc.js +++ b/code/utils_misc.js @@ -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();