Does anyone know how to fix this? I'm using leaflet 0.3.1 stable. If you run the following code
=============================
<div id="map" style="height:600px;width:1000px;"></div>
<script>
var map = new L.Map('map');
cloudmadeAttribution = 'Map data © 2011 OpenStreetMap contributors, Imagery © 2011 CloudMade',
cloudmade = new L.TileLayer(cloudmadeUrl, {maxZoom: 18, attribution: cloudmadeAttribution});
var usaCenterPoint = new L.LatLng(49.15296965617039, -111.97265625);
map.setView(usaCenterPoint, 3).addLayer(cloudmade);
</script>
=============================
You should get a fairly well centered map that includes the 48 contiguous states + Alaska and Hawaii.
If you then add this line to restrict the user from shifting from this view
map.setMaxBounds(map.getBounds());
it throws it off, seems to affect the zoom level. I've also tried manually recording the southwest and northeast corner latlngs and creating the max bounds that way... then I always end up in Europe. Example :
=============================
<div id="map" style="height:600px;width:1000px;"></div>
<script>
var map = new L.Map('map');
cloudmadeAttribution = 'Map data © 2011 OpenStreetMap contributors, Imagery © 2011 CloudMade',
cloudmade = new L.TileLayer(cloudmadeUrl, {maxZoom: 18, attribution: cloudmadeAttribution});
var usaCenterPoint = new L.LatLng(49.15296965617039, -111.97265625);
var southWest = new L.LatLng(3.8642546157214084, -199.86328125);
var northEast = new L.LatLng(73.12494524712693 , -24.08203125);
var bounds = new L.LatLngBounds(southWest, northEast);
map.setView(usaCenterPoint, 1).addLayer(cloudmade);
map.setMaxBounds(bounds);
</script>
=============================
Any suggestions ? Thanks