Bug Fix: selected portal unselect if portal re-render
Add a checking: if portal is not visible on map, don't preserve "selectedPortal"
This commit is contained in:
parent
55506b7207
commit
fd7940c2ae
@ -128,11 +128,13 @@ window.handleDataResponse = function(data, textStatus, jqXHR) {
|
|||||||
// Preserve and restore "selectedPortal" between portal re-render
|
// Preserve and restore "selectedPortal" between portal re-render
|
||||||
if(portalUpdateAvailable) var oldSelectedPortal = selectedPortal;
|
if(portalUpdateAvailable) var oldSelectedPortal = selectedPortal;
|
||||||
$.each(ppp, function(ind, portal) { renderPortal(portal); });
|
$.each(ppp, function(ind, portal) { renderPortal(portal); });
|
||||||
if(portalUpdateAvailable) selectedPortal = oldSelectedPortal;
|
|
||||||
|
|
||||||
if(portals[selectedPortal]) {
|
var selectedPortalLayer = portals[oldSelectedPortal];
|
||||||
|
if(portalUpdateAvailable && selectedPortalLayer) selectedPortal = oldSelectedPortal;
|
||||||
|
|
||||||
|
if(selectedPortalLayer) {
|
||||||
try {
|
try {
|
||||||
portals[selectedPortal].bringToFront();
|
selectedPortalLayer.bringToFront();
|
||||||
} catch(e) { /* portal is now visible, catch Leaflet error */ }
|
} catch(e) { /* portal is now visible, catch Leaflet error */ }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user