Search for portals: select portal on click
This commit is contained in:
parent
6b027d15fe
commit
46a1684549
@ -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
|
||||
},
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user