add linting to examples (WIP)

This commit is contained in:
Vladimir Agafonkin
2021-11-29 15:56:50 +02:00
parent 0a61e9065b
commit 326211d5d4
5 changed files with 151 additions and 27 deletions

View File

@ -17,39 +17,37 @@ title: Zoom Levels Tutorial
attribution: cartodbAttribution
}).addTo(map);
function zoomCycle(){
function zoomCycle() {
map.setZoom(0);
timeouts = [];
timeouts.push(setTimeout(function(){ map.setZoom(0.25); }, 1000));
timeouts.push(setTimeout(function(){ map.setZoom(0.50); }, 2000));
timeouts.push(setTimeout(function(){ map.setZoom(0.75); }, 3000));
timeouts.push(setTimeout(function(){ map.setZoom(1); }, 4000));
timeouts.push(setTimeout(function(){ map.setZoom(0.75); }, 5000));
timeouts.push(setTimeout(function(){ map.setZoom(0.50); }, 6000));
timeouts.push(setTimeout(function(){ map.setZoom(0.25); }, 7000));
var timeouts = [];
timeouts.push(setTimeout(function () { map.setZoom(0.25); }, 1000));
timeouts.push(setTimeout(function () { map.setZoom(0.50); }, 2000));
timeouts.push(setTimeout(function () { map.setZoom(0.75); }, 3000));
timeouts.push(setTimeout(function () { map.setZoom(1.00); }, 4000));
timeouts.push(setTimeout(function () { map.setZoom(0.75); }, 5000));
timeouts.push(setTimeout(function () { map.setZoom(0.50); }, 6000));
timeouts.push(setTimeout(function () { map.setZoom(0.25); }, 7000));
}
zoomCycle();
var zoomingInterval = setInterval(zoomCycle, 8000);
var ZoomViewer = L.Control.extend({
onAdd: function(){
var container= L.DomUtil.create('div');
onAdd: function () {
var container = L.DomUtil.create('div');
var gauge = L.DomUtil.create('div');
container.style.width = '200px';
container.style.background = 'rgba(255,255,255,0.5)';
container.style.textAlign = 'left';
map.on('zoomstart zoom zoomend', function(ev){
map.on('zoomstart zoom zoomend', function (ev) {
gauge.innerHTML = 'Zoom level: ' + map.getZoom();
})
});
container.appendChild(gauge);
return container;
}
});
var zoomViewerControl = (new ZoomViewer).addTo(map);
var zoomViewerControl = (new ZoomViewer()).addTo(map);
map.setView([0, 0], 0);
</script>

View File

@ -18,9 +18,9 @@ title: Zoom Levels Tutorial
var scaleControl = L.control.scale({maxWidth: 150}).addTo(map);
setInterval(function(){
setInterval(function () {
map.setView([0, 0], 0, {duration: 1, animate: true});
setTimeout(function(){
setTimeout(function () {
map.setView([60, 0], 0, {duration: 1, animate: true});
}, 2000);
}, 4000);

View File

@ -15,30 +15,30 @@ title: Zoom Levels Tutorial
attribution: cartodbAttribution
}).addTo(map);
setInterval(function(){
setInterval(function () {
map.setZoom(0);
setTimeout(function(){
setTimeout(function () {
map.setZoom(1);
}, 2000);
}, 4000);
var ZoomViewer = L.Control.extend({
onAdd: function(){
onAdd: function () {
var gauge = L.DomUtil.create('div');
gauge.style.width = '200px';
gauge.style.background = 'rgba(255,255,255,0.5)';
gauge.style.textAlign = 'left';
map.on('zoomstart zoom zoomend', function(ev){
map.on('zoomstart zoom zoomend', function (ev) {
gauge.innerHTML = 'Zoom level: ' + map.getZoom();
})
});
return gauge;
}
});
var zoomViewer = (new ZoomViewer).addTo(map);
var zoomViewer = (new ZoomViewer()).addTo(map);
map.setView([0, 0], 0);
</script>