[Test] Cambio visibilidad OL
by Francisco
HTML
<script src="https://mapea4-sigc.juntadeandalucia.es/vendor/browser-polyfill.js"></script>
<script src="https://mapea4-sigc.juntadeandalucia.es/js/mapea-5.0.0.ol.min.js"></script>
<link rel="stylesheet" href="https://mapea4-sigc.juntadeandalucia.es/assets/css/mapea-5.0.0.ol.min.css">
<script src="https://mapea4-sigc.juntadeandalucia.es/js/configuration-5.0.0.js"></script>
<div id="map"></div>
CSS
html,
body,
#map {
padding: 0;
margin: 0;
width: 100%;
height: 100%;
}
JavaScript
mapajs = M.map({
container: "map",
controls: ['layerswitcher'],
wmcfiles: ['callejero']
});
mapajs.on(M.evt.COMPLETED, function() {
let layers = mapajs.getLayers();
layers.forEach(function(layer) {
if (layer.getImpl().getOL3Layer()) {
layer.getImpl().getOL3Layer().on("change:visible", function(capa) {
console.log('CAMBIADA VISIBILIDAD:', layer.name);
});
}
});
});