This control adapts maps to low-bandwidth conditions. By default, it requests
a test tile to determine speed, but accepts options that allow you to subsitute
your own detection method. This method only works on composited tiles - that is,
combinations of tilesets with the characteristic ,
between their tileset
names.
<div id='map-div'></div>
<a href='#' id='trigger-low'>low quality</a>
<a href='#' id='trigger-high'>high quality</a>
<script>
var url = 'https://api.tiles.mapbox.com/v3/mapbox.blue-marble-topo-jul.jsonp';
wax.tilejson(url, function(tilejson) {
var m = new MM.Map('map-div',
new wax.mm.connector(tilejson), null,
[new MM.MouseHandler(), new MM.TouchHandler()]);
var bw = wax.mm.bwdetect(m, {
png: '.png32'
});
document.getElementById('trigger-low').onclick = function() {
bw.bw(0); return false;
};
document.getElementById('trigger-high').onclick = function() {
bw.bw(1); return false;
};
m.setCenterZoom({ lat: 39, lon: -98 }), 2);
});
</script>
bwdetect = wax.mm.bwdetect(map, options
bwdetect.bw(0 or 1)