Merge pull request #366 from mikeprimm/master

Fix defaultzoom: 0 not working
This commit is contained in:
mikeprimm 2011-08-03 06:14:53 -07:00
commit db0fadc5de

View File

@ -102,8 +102,11 @@ DynMap.prototype = {
if(urlzoom != null) if(urlzoom != null)
me.options.defaultzoom = urlzoom; me.options.defaultzoom = urlzoom;
if(typeof me.options.defaultzoom == 'undefined')
me.options.defaultzoom = 1;
var map = this.map = new L.Map(mapContainer.get(0), { var map = this.map = new L.Map(mapContainer.get(0), {
zoom: me.options.defaultzoom || 1, zoom: me.options.defaultzoom,
center: new L.LatLng(0, 0), center: new L.LatLng(0, 0),
zoomAnimation: true, zoomAnimation: true,
crs: L.Util.extend({}, L.CRS, { crs: L.Util.extend({}, L.CRS, {
@ -323,7 +326,6 @@ DynMap.prototype = {
me.world = mapWorld; me.world = mapWorld;
me.maptype = map; me.maptype = map;
me.map.addLayer(me.maptype);
if(me.maptype.options.maxZoom < prevzoom) if(me.maptype.options.maxZoom < prevzoom)
prevzoom = me.maptype.options.maxZoom; prevzoom = me.maptype.options.maxZoom;
me.map.options.maxZoom = me.maptype.options.maxZoom; me.map.options.maxZoom = me.maptype.options.maxZoom;
@ -343,6 +345,7 @@ DynMap.prototype = {
else { else {
me.map.setZoom(prevzoom); me.map.setZoom(prevzoom);
} }
me.map.addLayer(me.maptype);
if (worldChanged) { if (worldChanged) {
$(me).trigger('worldchanged'); $(me).trigger('worldchanged');