draw resonator lines below resonators when selecting a portal. Also reduce code duplication
This commit is contained in:
parent
146c061a3b
commit
e69ba16a23
@ -412,33 +412,26 @@ window.portalResetColor = function(portal) {
|
||||
}
|
||||
|
||||
window.resonatorsResetStyle = function(portalGuid) {
|
||||
for(var i = 0; i < 8; i++) {
|
||||
resonatorLayerGroup = resonators[portalResonatorGuid(portalGuid, i)];
|
||||
if(!resonatorLayerGroup) continue;
|
||||
resonatorLayerGroup.eachLayer(function(layer) {
|
||||
if (layer.options.guid) {
|
||||
// Resonator
|
||||
layer.setStyle(OPTIONS_RESONATOR_NON_SELECTED);
|
||||
} else {
|
||||
// Resonator line
|
||||
layer.setStyle(OPTIONS_RESONATOR_LINE_NON_SELECTED);
|
||||
}
|
||||
});
|
||||
}
|
||||
window.resonatorsSetStyle(portalGuid, OPTIONS_RESONATOR_NON_SELECTED, OPTIONS_RESONATOR_LINE_NON_SELECTED);
|
||||
}
|
||||
|
||||
window.resonatorsSetSelectStyle = function(portalGuid) {
|
||||
window.resonatorsSetStyle(portalGuid, OPTIONS_RESONATOR_SELECTED, OPTIONS_RESONATOR_LINE_SELECTED);
|
||||
}
|
||||
|
||||
window.resonatorsSetStyle = function(portalGuid, resoStyle, lineStyle) {
|
||||
for(var i = 0; i < 8; i++) {
|
||||
resonatorLayerGroup = resonators[portalResonatorGuid(portalGuid, i)];
|
||||
if(!resonatorLayerGroup) continue;
|
||||
// bring resonators and their connection lines to front separately.
|
||||
// this way the resonators are drawn on top of the lines.
|
||||
resonatorLayerGroup.eachLayer(function(layer) {
|
||||
if (layer.options.guid) {
|
||||
// Resonator
|
||||
layer.bringToFront().setStyle(OPTIONS_RESONATOR_SELECTED);
|
||||
} else {
|
||||
// Resonator line
|
||||
layer.bringToFront().setStyle(OPTIONS_RESONATOR_LINE_SELECTED);
|
||||
}
|
||||
if (!layer.options.guid) // Resonator line
|
||||
layer.bringToFront().setStyle(lineStyle);
|
||||
});
|
||||
resonatorLayerGroup.eachLayer(function(layer) {
|
||||
if (layer.options.guid) // Resonator
|
||||
layer.bringToFront().setStyle(resoStyle);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user