A control that enables users to select a bounds on a map by holding the shift key and dragging on a map. It’s useful for stuff like selecting areas to render in TileMill or areas to download for offline use.
var url = 'https://api.tiles.mapbox.com/v3/mapbox.blue-marble-topo-bathy-jul.jsonp';
wax.tilejson(url, function(tilejson) {
var m = new MM.Map('map-div',
new wax.mm.connector(tilejson));
wax.mm.boxselector(m, tilejson, {
callback: function(coords) {
$('#boxselector-text').text(
coords.map(function(c) {
return c.lat + ',' + c.lon;
}).join(' - '));
}
});
m.setCenterZoom({ lat: 39, lon: -98 }, 2);
});
var boxselector = wax.mm.boxselector(map, options or callback)coords, containing the extent of a selection, as represented
by an array with two elements of type com.modestmaps.Location.
var extent = boxselector.extent()boxselector.extent([com.modestmaps.Location, com.modestmaps.Location], [silent])