adjust the portal bring to front code so that artifact portals are above all others

This commit is contained in:
Jon Atkins
2013-11-10 04:05:17 +00:00
parent 3e12534456
commit 53d66ee57f

View File

@ -155,25 +155,32 @@ window.Render.prototype.bringPortalsToFront = function() {
for (var lvl in portalsFactionLayers) {
// portals are stored in separate layers per faction
// to avoid giving weight to one faction or another, we'll push portals to front based on GUID order
var portals = {};
var lvlPortals = {};
for (var fac in portalsFactionLayers[lvl]) {
var layer = portalsFactionLayers[lvl][fac];
if (layer._map) {
layer.eachLayer (function(p) {
portals[p.options.guid] = p;
lvlPortals[p.options.guid] = p;
});
}
}
var guids = Object.keys(portals);
var guids = Object.keys(lvlPortals);
guids.sort();
for (var j in guids) {
var guid = guids[j];
portals[guid].bringToFront();
lvlPortals[guid].bringToFront();
}
}
// artifact portals are always brought to the front, above all others
$.each(artifact.getInterestingPortals(), function(i,guid) {
if (portals[guid] && portals[guid]._map) {
portals[guid].bringToFront();
}
});
}