[missions] Bugfix: plugin would break and show weird dialogs if the mission markers aren't enabled
This commit is contained in:
parent
96a8a94d48
commit
4146d46e5b
@ -785,12 +785,15 @@ window.plugin.missions = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
highlightMissionLayers: function(markers) {
|
highlightMissionLayers: function(markers) {
|
||||||
|
// layer.bringToFront() will break if the layer is not visible
|
||||||
|
var bringToFront = map.hasLayer(plugin.missions.missionLayer);
|
||||||
|
|
||||||
this.missionLayer.eachLayer(function(layer) {
|
this.missionLayer.eachLayer(function(layer) {
|
||||||
var active = (markers.indexOf(layer) !== -1);
|
var active = (markers.indexOf(layer) !== -1);
|
||||||
layer.setStyle({
|
layer.setStyle({
|
||||||
color: active ? this.MISSION_COLOR_ACTIVE : this.MISSION_COLOR,
|
color: active ? this.MISSION_COLOR_ACTIVE : this.MISSION_COLOR,
|
||||||
});
|
});
|
||||||
if(active) layer.bringToFront();
|
if(active && bringToFront) layer.bringToFront();
|
||||||
}, this);
|
}, this);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user