Fixed #9299 -- Made default zoom level for points in the admin more sensible. Thanks to oyvind for ticket and initial patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10635 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Justin Bronn 2009-04-26 06:01:59 +00:00
parent 66db0b43ad
commit 1269f9a3e9
2 changed files with 6 additions and 0 deletions

View File

@ -33,6 +33,7 @@ class GeoModelAdmin(ModelAdmin):
map_srid = 4326
map_template = 'gis/admin/openlayers.html'
openlayers_url = 'http://openlayers.org/api/2.7/OpenLayers.js'
point_zoom = num_zoom - 6
wms_url = 'http://labs.metacarta.com/wms/vmap0'
wms_layer = 'basic'
wms_name = 'OpenLayers WMS'
@ -100,6 +101,7 @@ class GeoModelAdmin(ModelAdmin):
'scale_text' : self.scale_text,
'map_width' : self.map_width,
'map_height' : self.map_height,
'point_zoom' : self.point_zoom,
'srid' : self.map_srid,
'display_srid' : self.display_srid,
'wms_url' : self.wms_url,
@ -124,4 +126,5 @@ if gdal.HAS_GDAL:
map_srid = 900913
max_extent = '-20037508,-20037508,20037508,20037508'
max_resolution = 156543.0339
point_zoom = num_zoom - 6
units = 'm'

View File

@ -127,6 +127,9 @@
}
// Zooming to the bounds.
{{ module }}.map.zoomToExtent(admin_geom.geometry.getBounds());
if ({{ module }}.is_point){
{{ module }}.map.zoomTo({{ point_zoom }});
}
} else {
{{ module }}.map.setCenter(new OpenLayers.LonLat({{ default_lon }}, {{ default_lat }}), {{ default_zoom }});
}