restore support for a selected portal in the URL

This commit is contained in:
Jon Atkins 2013-08-30 06:55:08 +01:00
parent 13d247019c
commit b958d1b519

View File

@ -241,15 +241,32 @@ window.Render.prototype.createPortalEntity = function(ent) {
window.portals[ent[0]] = marker;
// re-select the portal, to refresh the sidebar on any changes
if (ent[0] === selectedPortal) {
selectPortal (ent[0]);
// check for URL links to portal, and select it if this is the one
if (urlPortalLL && urlPortalLL[0] == marker.getLatLng().lat && urlPortalLL[1] == marker.getLatLng().lng) {
// URL-passed portal found via pll parameter - set the guid-based parameter
console.log('urlPortalLL '+urlPortalLL[0]+','+urlPortalLL[1]+' matches portal GUID '+ent[0]);
urlPortal = ent[0];
urlPortalLL = undefined; // clear the URL parameter so it's not matched again
}
if (urlPortal == ent[0]) {
// URL-passed portal found via guid parameter - set it as the selected portal
console.log('urlPortal GUID '+urlPortal+' found - selecting...');
selectedPortal = ent[0];
urlPortal = undefined; // clear the URL parameter so it's not matched again
}
// (re-)select the portal, to refresh the sidebar on any changes
if (ent[0] == selectedPortal) {
console.log('portal guid '+ent[0]+' is the selected portal - re-rendering portal details');
renderPortalDetails (selectedPortal);
}
//TODO? postpone adding to the map layer
portalsLayers[parseInt(portalLevel)].addLayer(marker);
}